Skip to content

Instantly share code, notes, and snippets.

@srang992
Last active April 12, 2023 15:08
Show Gist options
  • Save srang992/fe00c7f062e4b9ca7686ef01cf947379 to your computer and use it in GitHub Desktop.
Save srang992/fe00c7f062e4b9ca7686ef01cf947379 to your computer and use it in GitHub Desktop.
import pickle
import psycopg2
# loading the file containing credentials
with open("heroku_database_credentials.pickle", "rb") as cred:
credential = pickle.load(cred)
# connecting to the postgresql database with those credentials
conn = psycopg2.connect(database=credential['Database'],
host=credential['Host'],
user=credential['User'],
port=credential['Port'],
password=credential['Password'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment