Skip to main content

Simplify the testing of SQL data models and queries by allowing users to mock input data and create tests for various scenarios. It provides a consistent and convenient way to test the execution of your query without the need to process a massive amount of data.

Project description

SQLMock Logo

SQL Mock: Python Library for Mocking SQL Queries with Dictionary Inputs

PyPI version Supported Python versions License: MIT

The primary purpose of this library is to simplify the testing of SQL data models and queries by allowing users to mock input data and create tests for various scenarios. It provides a consistent and convenient way to test the execution of your query without the need to process a massive amount of data.

Documentation

A full documentation can be found on the documentation page

The library currently supports the following databases.

  • BigQuery
  • Clickhouse
  • Redshift
  • Snowflake

Installation

The library can be installed from PyPI using pip:

# BigQuery
pip install --upgrade "sql-mock[bigquery]"

# Clickhouse
pip install --upgrade "sql-mock[clickhouse]"

# Redshift
pip install --upgrade "sql-mock[redshift]"

# Snowflake
pip install --upgrade "sql-mock[snowflake]"

If you need to modify this source code, install the dependencies using poetry:

poetry install --all-extras

Pydantic V1 vs. V2

SQL Mock's published version supports Pydantic V2. You might run into issues when your code depends on Pydantic V1. We have an alternative branch you can install from that supports Pydantic V1 in the meanwhile: https://github.com/DeepLcom/sql-mock/tree/pydantic-v1

Contributing

We welcome contributions to improve and enhance this open-source project. Whether you want to report issues, suggest new features, or directly contribute to the codebase, your input is valuable. To ensure a smooth and collaborative experience for both contributors and maintainers, please follow these guidelines:

Reporting Issues

If you encounter a bug, have a feature request, or face any issues with the project, we encourage you to report them using the project's issue tracker. When creating an issue, please include the following information:

  • A clear and descriptive title.
  • A detailed description of the problem or suggestion.
  • Steps to reproduce the issue (if applicable).
  • Any error messages or screenshots that help clarify the problem.

Feature Requests

If you have ideas for new features or improvements, please use the project's issue tracker to submit a feature request. We appreciate well-documented feature requests that explain the motivation and potential use cases.

Contributing Code

Find more about contributing code in the Contribution Guidelines

Experimental

SQL Mock Buddy - A custom (Chat) GPT to support you

We ran a small experiment to create a custom GPT for SQL Mock. The SQL Mock Buddy can be accessed here: https://chat.openai.com/g/g-FIXNcqu1l-sql-mock-buddy

SQL Mock Buddy should help you to get started quickly with SQL Mock.

It is still in beta mode and you should definitely double-check its output!

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

sql_mock-0.5.4.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

sql_mock-0.5.4-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file sql_mock-0.5.4.tar.gz.

File metadata

  • Download URL: sql_mock-0.5.4.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.7 Linux/6.2.0-1018-azure

File hashes

Hashes for sql_mock-0.5.4.tar.gz
Algorithm Hash digest
SHA256 de8c5532660bd8c8d0ff3fc1e436a0956d1610a7b455703be029b6ea1c1ce69a
MD5 051c2d1b6abda42f7c44e1e2a803b728
BLAKE2b-256 384d483a2097d2ce6cc428302da68f44c40974f79f99c7fc4b8e4f4c732bdaaa

See more details on using hashes here.

File details

Details for the file sql_mock-0.5.4-py3-none-any.whl.

File metadata

  • Download URL: sql_mock-0.5.4-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.7 Linux/6.2.0-1018-azure

File hashes

Hashes for sql_mock-0.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 643c91ce822871425476524797b99cf4c25ecee7cf9495e88476b52186c04654
MD5 68fb1b66be75ffc9517b5848046db1e6
BLAKE2b-256 c5286037537037f19ca61e0ffcac01420d3bfdab28b66565a9a40c2741c81095

See more details on using hashes here.

Supported by

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