Skip to main content

A helper package to use common functions

Project description

Helpful Helper

A (so far) little package that contains commonly used and useful functions. Good for team morale as they say.

About

Contents include functions for connecting to redshift and using gspread, a py library for writing and reading from google sheets. For help with what functions are available, please run get_help() after importing helpful-pys.

Official pypi

Installation

To install functional-functions, you can install it using pip:

pip install helpful-pys

Within your jupyter lab/notebook setup:

from helpful_pys import helper

helper.get_help()

Before Using

Once the package is installed, your package will be found within your site-packages folder

  1. Rename your local creds file within the helpful_pys(rename creds.py.sample to creds.py)
  2. Please authorize access to google sheets API and insert generated service account key into your local creds file, see Additional prerequisites for more details
  3. Please fill in your redshift creds into the local creds file before using

Additional Prequisites

The package will install gspread but will require further setup to get it running. I recommend using the gspread documentation for Authentication which will allow you to authorize the google sheets API and generate a service account key.

Don't forget the client-email in your key, it will be constantly needed to give share access to sheets for usage with gspread.

I have included a creds.py.sample file in the package to allow the user to input their personal creds to use. If there are better access/security storage policies like AWS Secrets Manager, this repo can be updated to accommodate such.

Usage

This package is intended for usage with local py setups and local jupyter notebook/lab setups. It is not intended for production script usage.

Querying Redshift

q = "select * from that_table limit 100"

result_df = helper.query_redshift(q)

Using gspread

gc = helper.gsheets_start()

workbook = gc.open_by_url('googlesheetsurlhere')

workbook.update_title("Really Cool and Helpful Workbook")

ws = test.worksheet('Sheet1')
ws.update_title("The coolest worksheet")


data_formatted = data[['id','helpful_id','cool_id']].copy()

ws.update([data_formatted.columns.values.tolist()] + data_formatted.values.tolist())

More gspread example use cases

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

helpful_pys-0.2.3.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

helpful_pys-0.2.3-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file helpful_pys-0.2.3.tar.gz.

File metadata

  • Download URL: helpful_pys-0.2.3.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for helpful_pys-0.2.3.tar.gz
Algorithm Hash digest
SHA256 da1406e5748e4f4b5af91888c89285739bf3899d3ddaf0a2f8e8aeccbfd67a3e
MD5 20786fcd19f19647fa196e52887ba3b7
BLAKE2b-256 019dd2e18c7d1aeed2d3bcd727b85fa17749c80bb1dc419d1352e475cf2a9ddc

See more details on using hashes here.

File details

Details for the file helpful_pys-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: helpful_pys-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for helpful_pys-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2c685f784808df34defd90cbe28aaefaa8f07968f63e2d582f75291194b7c038
MD5 6066348ac9b8bd561a1e0a8196e6c1f4
BLAKE2b-256 497bd35d601a531f8a20fedd66e2be9d13bee90d722417eb1cb7eb5f11bec7d7

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