Skip to main content

Create a Pandas dataframe with your Redshift data

Project description

This package will help you to create Pandas dataframe with your Redshift data with just 2 lines of Python codes.

How to use

  1. Install this package with pip CLI.

    $ pip install red2df
    
  2. Make Redshift db cursor with your Redshift information.

    from red2df import RedshiftToDf
    
    DATABASE = "your DB name"
    USER = "your user name"
    PASSWORD = "your password"
    HOST = "your Redshift endpoint url"
    #PORT = your port number in integer. Default is 5439
    
    #create an instance
    cur = RedshiftToDf(DATABASE, USER, PASSWORD, HOST)
    
  3. Run SQL queries and print dataframe.

    df = cur.create_df("your query")
    print(df)
    
    """
    example of result:
    +----+-----------------------+
    |    | user_data__platform   |
    |----+-----------------------|
    |  0 | ANDROID_APP           |
    |  1 | ANDROID_APP           |
    +----+-----------------------+
    """
    
  4. You also can save the result of query in csv. Please give save_csv=True option when you call create_df().

    • The parameters of create_df():
      • sql[str] : SQL query you want to run
      • save_csv[bool] : Save the result of the given query in csv if True. Default is False
      • file_path[str] : Path of csv file. Default is './df.csv'.
  5. If you want to close your connection, please call close_connection()

    cur.close_connection()
    

Please feel free to email me if there is any problem - hyunie@tumblbug.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

red2df-1.1.0-py2.py3-none-any.whl (3.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file red2df-1.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: red2df-1.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.16

File hashes

Hashes for red2df-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cf4a96fc1be1451e4c508c55115ae51a139936ee973056ad94c97d2609517dd8
MD5 994706942c3c304868767a6bd736e8ba
BLAKE2b-256 629a01a6a5e05edf1666f0d602112992f559f42760508cd2302a303996152800

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