Skip to main content

Module for quick and easy access to redshift using pandas

Project description

pandashift

Wrapper for working with Amazon Redshift using pandas without the use of S3

Installing

pip install pandashift

Usage

There are 2 ways work with this package

  1. Setting up environment variables
  2. Passing credentials on every call

Below are examples of both approaches

With environment variables set up

from pandashift import read_query, execute_query, load_db

# Read Data
df = read_query('SELECT * FROM public.test')

# Execute statement (aka table create/drop/etc)
execute_query('TRUNCATE public.test')

# Loading dataframe
load_df(df, table_name ='public.test')

No environment variables

from pandashift import read_query, execute_query, load_db

creds = {
        "host":"YOUR HOST",
        "port":"YOUR PORT",
        "dbname":"YOUR DATABASE",
        "user":"YOUR USER",
        "password":"YOUR PASSWORD"
        }

# Read Data
df = read_query('SELECT * FROM public.test',credentials = creds)

# Execute statement (aka table create/drop/etc)
execute_query('TRUNCATE public.test',credentials = creds)

# Loading dataframe
load_df(df, table_name = 'public.test',credentials = creds)

Functions

load_df

Parameter Usage
init_df The dataframe for loading
table_name The table that you want to load the df to
credentials Credentials to use for connection if any
verify_column_names The checks that the dataframe column order matches the table column order, by default True
empty_str_as_null This option will interpret empty string '' as NULL, by default True
maximum_insert_length Maximum length of the insert statement, alter this if you get error exceeding the max statement length, by default 16000000
perform_analyze If this is true at the end of loading will run ANALYZE table, by default False

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

pandashift-1.0.2.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pandashift-1.0.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file pandashift-1.0.2.tar.gz.

File metadata

  • Download URL: pandashift-1.0.2.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.20

File hashes

Hashes for pandashift-1.0.2.tar.gz
Algorithm Hash digest
SHA256 19d69838a6556aa247b82e469be880e3ca7f22b031956ff9a20a33677ce0db96
MD5 16940c3dad566f9af2e81bd8090bcf1f
BLAKE2b-256 3e7f4cae824417cb9677c5b2491493b15f320f22643fc9ea0be01f0d1bf460fb

See more details on using hashes here.

File details

Details for the file pandashift-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: pandashift-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.20

File hashes

Hashes for pandashift-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 30bdf455aef573f5056c657aff6380965758be071e215e6da85e795701378442
MD5 3842e8e9d49cd209c6c40a77a846ba8b
BLAKE2b-256 26092619cd4493e9a342cd552951fc7320eb83d7ccbfe9d2e96f1eb915dac7d8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page