Bulk loading pandas dataframe to snowflake table
Project description
pandas_to_snowflake
This is a python Package meant to making it easier for uploading dataframe to snowflake tables.
Installation
To install the latest Pypi version, you’ll need to execute:
pip install pandas_to_snowflake
or
python3 -m pip install pandas_to_snowflake
If instead you want to install the latest github master version:
git clone https://github.com/nit567esh/pandas_to_snowflake.git
cd <pkg_directory>
python3 setup.py install
Drivers
This library uses snowflake.connector for connecting to Snowflake.
Usage
You’ll have available 3 functions fro different kind of operations:
1. sf_create
- You can create a table from scratch from python and upload the contents of the data frame.
2. sf_append
- You can insert/append the contents of the pandas data frame into existing snowflake table.
3. sf_upsert
- You can insert and update the existing snowflake table using contents of the pandas data frame.
# Step 1: Import package
import pandas_to_snowflake as ps
# Step 2: Configure snowflake authentication
snowflake_auth=(user, password, account, warehouse, database, port)
# Step 3: Use sf_create, sf_append or sf_upsert
sf_create(snowflake_auth, sql_ddl)
Example - ps.sf_create(snowflake_auth = snowflake_auth,
sql_ddl = "create table test (custkey number default null, orderdate date default null)")
sf_append(dataframe, snowflake_auth, schema, table)
Example - ps.sf_append(dataframe=iris, snowflake_auth = snowflake_auth, schema = 'analytics', table = 'iris'")
sf_upsert(dataframe, snowflake_auth, schema, table, upsertkey=('cols',....))
Example - ps.sf_upsert(dataframe=order, snowflake_auth = snowflake_auth, schema = 'analytics', table='order', upsertkey=('date','product',))
Project details
Release history Release notifications | RSS feed
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
Hashes for pandas_to_snowflake-2.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2db6b819ea1a2db7b83cfba45231f024a00d70070dd0c9a92b74b0202181542a |
|
MD5 | 19a4a8a118d8c5b2d357073d6456aba5 |
|
BLAKE2b-256 | 7c9b2f4e7a7851ede29dcf20267b6ab010be2ca237d2b60749090258fac65014 |
Hashes for pandas_to_snowflake-2.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2681279f01a159aa72ea4bc62e4b8742f2fcc0aebe5de9a183db57fb611aa51 |
|
MD5 | f860fe93646483c40aa4a1130f5960f8 |
|
BLAKE2b-256 | 235484dc4d713812b27e945e2c7987c6cf1c446d046ed84d0080906130d7cfac |