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.3.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

dask_snowflake-0.3.3-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dask-snowflake-0.3.3.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for dask-snowflake-0.3.3.tar.gz
Algorithm Hash digest
SHA256 5cb58b99981ef35bd32510bf54ada3132689b56f76e16d54b774834b3bf95391
MD5 cc08098cbdd76546d6d291c4982422ef
BLAKE2b-256 11b99034b75e369afdb32e49f05d2372ed65e9f1e5c21cee3909927a0ed226f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dask_snowflake-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 801b1d302793b86e363b58aa8fdad4785ed6ec4ed6e8167723659a1561c5b6a5
MD5 603b841734ae05ef2f9e1ff519049e18
BLAKE2b-256 c9458e577e85cd1e5c16b73eeb6b932702f5a1e3bcef95e8fc017f22c9c55451

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