Dask + Snowflake intergration
Project description
Dask-Snowflake
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 ofcffi
from conda-forge. Remove it and install the version usingpip
:conda remove cffi --force pip install cffi
License
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
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cb58b99981ef35bd32510bf54ada3132689b56f76e16d54b774834b3bf95391 |
|
MD5 | cc08098cbdd76546d6d291c4982422ef |
|
BLAKE2b-256 | 11b99034b75e369afdb32e49f05d2372ed65e9f1e5c21cee3909927a0ed226f7 |
File details
Details for the file dask_snowflake-0.3.3-py3-none-any.whl
.
File metadata
- Download URL: dask_snowflake-0.3.3-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 801b1d302793b86e363b58aa8fdad4785ed6ec4ed6e8167723659a1561c5b6a5 |
|
MD5 | 603b841734ae05ef2f9e1ff519049e18 |
|
BLAKE2b-256 | c9458e577e85cd1e5c16b73eeb6b932702f5a1e3bcef95e8fc017f22c9c55451 |