Skip to main content

Connectivator

Set of wrapper functions to abstract repetitive tasks such as reading data from a Redshift/postgres databases, and writing their contents to a CSV or Google sheet. The lack of flexibility is done on purpose to simplify and standardize importing/exporting procedures. For more flexibility, simply use the original packages these wrapper functions were built upon, i.e. pandas, gspread, etc.

Current State

  • Connect to Postgres / Redshift: postgres.get_engine
  • Read output of a sql query into a data frame: transfer.read_sql_data
  • Write output of SQL files to CSV: transfer.sqls_to_csv
  • Read contents of a Google sheet into a data frame: gsheets.get_ws_data
  • Update contents of a Google sheet using a data frame: gsheets.update_ws
  • Write output of SQL files to Google sheet: transfer.sqls_to_gs

Environment Variables

  • Add a .env file to the project root directory.
  • Add the following environment variables, replacing with values relevant for your connections. Format:

Postgres/Redshift Environment Variables

export PGHOST = instance-name.abc123.us-east-1.redshift.amazonaws.com
export PGPORT = 5439
export PGUSER = your_user_name
export PGPASSWORD = your_password
  • Load the environment variables before running the script. For example, by running source .env in the terminal you are using to run Python scripts.

Google Sheets Credient File and Environment Variable

Requires a json credentials file, which can be downloaded when creating a service account within a Google developer console project. The Google Sheets API enabled also must be enabled. See: https://developers.google.com/sheets/api/quickstart/python

Also, the google sheet to be modified needs to give access to the Service Account. To do so, find the email associated to the service account under Credentials >> Manage Service Accounts of the Google Console project. Then go to the google sheet to be modified and allow edit access to this email.

export GOOGLE_APPLICATION_CREDENTIALS="filepath/to.json"

Release files for connectivator 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for connectivator 0.0.7
File Size Uploaded
connectivator-0.0.7.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for connectivator 0.0.7
File Interpreter ABI Platform
connectivator-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / connectivator-0.0.7.tar.gz

Download URL connectivator-0.0.7.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cff655132e877d87147e2d5de189fd54f0cd58f7bcb9d919f1c17bef10526c5d
BLAKE2b-256 checksum
How to use checksums
5e0e67bd42d2c3ba40d73a3b32ade53b0a0a70e41cdf89dd69e59e3ba58aa3b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

Release files / connectivator-0.0.7-py3-none-any.whl

Download URL connectivator-0.0.7-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e4172c2e21eaed45abb275b549637755fc4743148bf62a7413bb8a7f000a91b
BLAKE2b-256 checksum
How to use checksums
5b4e6e84655e1c0c727943c5481a274fd4d73260989e1e16b5dc3459b80c9ae6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page