Skip to main content

Fake Snowflake Connector for Python. Run, mock and test Snowflake DB locally.

Project description

fakesnow ❄️

ci release PyPI PyPI - Downloads

Fake Snowflake Connector for Python. Run and mock Snowflake DB locally.


pip install fakesnow


Run with fakesnow:


Or a module, eg: pytest

fakesnow -m pytest

fakesnow executes fakesnow.patch before running the script or module.


To use fakesnow within your code:

import fakesnow
import snowflake.connector

with fakesnow.patch():
    conn = snowflake.connector.connect()

    print(conn.cursor().execute("SELECT 'Hello fake world!'").fetchone())

The following imports are automatically patched:

  • import snowflake.connector.connect
  • import snowflake.connector.pandas_tools.write_pandas

To patch modules that use the from ... import syntax, manually specify them, eg: if has the import:

from snowflake.connector.pandas_tools import write_pandas

Then patch it using:

with fakesnow.patch("mymodule.write_pandas"):

By default databases are in-memory. To persist databases between processes, specify a databases path:

with fakesnow.patch(db_path="databases/"):

pytest fixtures

pytest fixtures are provided for testing. Example

from typing import Iterator

import fakesnow.fixtures
import pytest

pytest_plugins = fakesnow.fixtures.__name__

@pytest.fixture(scope="session", autouse=True)
def setup(_fakesnow_session: None) -> Iterator[None]:
    # the standard imports are now patched

Or with from ... import patch targets:

from typing import Iterator

import fakesnow
import pytest

@pytest.fixture(scope="session", autouse=True)
def _fakesnow_session() -> Iterator[None]:
    with fakesnow.patch("mymodule.write_pandas"):

Implementation coverage

Partial support

  • date functions
  • regex functions
  • semi-structured data
  • tags
  • user management (See tests/

For more detail see tests/


  • The order of rows is non deterministic and may not match Snowflake unless ORDER BY is fully specified.
  • A more liberal Snowflake SQL dialect than a real Snowflake instance is supported, ie: some queries might pass using fakesnow that a real Snowflake instance would reject.


See to get started and develop in this repo.

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

fakesnow-0.9.7.tar.gz (55.2 kB view hashes)

Uploaded Source

Built Distribution

fakesnow-0.9.7-py3-none-any.whl (36.5 kB view hashes)

Uploaded Python 3

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