Skip to main content

Mock Redshift locally by transpiling Redshift SQL to DuckDB and running it.

Project description

rs-mock

A super lightweight, in-process Redshift mocker for test suites.

rs-mock transpiles Redshift SQL to duckdb SQL with sqlglot and runs it against an in-memory duckdb database. No cluster, no network, no Docker — just fast, in-process SQL.

Usage

from rs_mock import RedshiftMock

rs = RedshiftMock()

# DDL / DML — state persists across calls for the instance's lifetime
rs.execute("CREATE TABLE users (id INT, name VARCHAR)")
rs.execute("INSERT INTO users VALUES (1, 'alice'), (2, 'bob')")

# SELECTs, JOINs, CTEs — execute() returns the duckdb cursor
rows = rs.execute("SELECT id, name FROM users ORDER BY id").fetchall()
# [(1, 'alice'), (2, 'bob')]

# Need duckdb power features? Grab the cursor or the connection.
df = rs.execute("SELECT * FROM users").df()
rs.connection  # the underlying duckdb connection

Supported: regular selects, joins, CTEs, and DDL/DML. Redshift-specific syntax (e.g. GETDATE()) is rewritten to its duckdb equivalent automatically.

Development

make test   # run tests
make lint   # ruff + pyrefly
make prek   # pre-commit hooks

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rs_mock-0.1.0.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rs_mock-0.1.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file rs_mock-0.1.0.tar.gz.

File metadata

  • Download URL: rs_mock-0.1.0.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rs_mock-0.1.0.tar.gz
Algorithm Hash digest
SHA256 91f1195d343a5b9604175d65e09a9a81cc22d92a873cf6f5034ab6c5c64ece6a
MD5 476151aa2aa171635e816adc8e392e29
BLAKE2b-256 069fdcd8db240fa8ee7156050fd2973ec39bd92be8c1e95692e0f21f3aa7f1bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for rs_mock-0.1.0.tar.gz:

Publisher: release-please.yml on tylerriccio33/rs-mock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rs_mock-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rs_mock-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rs_mock-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ce2e47329f13f59b75de33de5d85b6ee592818bb5a02f599a1b0cc7ebb2b9ce
MD5 4074d6b3a172670f8d2c24f169655801
BLAKE2b-256 1131cee5269413e2e55377f6fdb7b774015e4aa7525a9c8427aef475e8fd8552

See more details on using hashes here.

Provenance

The following attestation bundles were made for rs_mock-0.1.0-py3-none-any.whl:

Publisher: release-please.yml on tylerriccio33/rs-mock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page