Skip to main content

Dask + Snowflake intergration

Project description

Dask-Snowflake

Tests Linting

This connector is in an early experimental/testing phase.

Reach out to us if you are interested in trying it out!

Installation

dask-snowflake can be installed with pip:

pip install dask-snowflake

or with conda:

conda install -c conda-forge dask-snowflake

Usage

dask-snowflake provides read_snowflake and to_snowflake methods for parallel IO from Snowflake with Dask.

>>> from dask_snowflake import read_snowflake
>>> example_query = '''
...    SELECT *
...    FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.CUSTOMER;
... '''
>>> ddf = read_snowflake(
...     query=example_query,
...     connection_kwargs={
...         "user": "...",
...         "password": "...",
...         "account": "...",
...     },
... )
>>> from dask_snowflake import to_snowflake
>>> to_snowflake(
...     ddf,
...     name="my_table",
...     connection_kwargs={
...         "user": "...",
...         "password": "...",
...         "account": "...",
...     },
... )

See their docstrings for further API information.

Tests

Running tests requires a Snowflake account and access to a database. The test suite will automatically look for specific SNOWFLAKE_* environment variables (listed below) that must be set.

It's recommended (though not required) to store these environment variables in a local .env file in the root of the dask-snowflake repository. This file will be automatically ignored by git, reducing the risk of accidentally commiting it.

Here's what an example .env file looks like:

SNOWFLAKE_USER="<test user name>"
SNOWFLAKE_PASSWORD="<test_user_password>"
SNOWFLAKE_ACCOUNT="<account>.<region>.aws"
SNOWFLAKE_WAREHOUSE="<test warehouse>"
SNOWFLAKE_ROLE="<test role>"
SNOWFLAKE_DATABASE="<test database>"
SNOWFLAKE_SCHEMA="<test schema>"

You may then source .env or install pytest-dotenv to automatically set these environment variables.

Note: If you run the tests and get an MemoryError mentioning "write+execute memory for ffi.callback()", you probably have stale build of cffi from conda-forge. Remove it and install the version using pip:

conda remove cffi --force
pip install cffi

License

BSD-3

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

dask-snowflake-0.3.1.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

dask_snowflake-0.3.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file dask-snowflake-0.3.1.tar.gz.

File metadata

  • Download URL: dask-snowflake-0.3.1.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for dask-snowflake-0.3.1.tar.gz
Algorithm Hash digest
SHA256 9893e3bec36e0109374631f5875fe08b3bc8ffcc1fa60472149b44bdb968f577
MD5 c481fdb4197008b1bc6a7aba2f40999a
BLAKE2b-256 549a45129af8c2c3329439e218ba5481360df8ab3062c8a85e9618fe6eb4de99

See more details on using hashes here.

Provenance

File details

Details for the file dask_snowflake-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for dask_snowflake-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a03b8d3a8d7b30850a15abed62179e4ede48cfab2da905849736d3720ba5231e
MD5 071f768cf5697b4c86931d8b84671c0a
BLAKE2b-256 b7609a7c98fb9a9a45ce9d21a2f3d1cde851ffa2050752458c4b4ce3310b565f

See more details on using hashes here.

Provenance

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