Skip to content

Instantly share code, notes, and snippets.

@CodeDrome
Created July 30, 2020 05:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodeDrome/073fb80e3915d69202c9b350ac2edeb7 to your computer and use it in GitHub Desktop.
Save CodeDrome/073fb80e3915d69202c9b350ac2edeb7 to your computer and use it in GitHub Desktop.
pgconnection.py
import psycopg2
def get_connection(dbname):
connect_str = "dbname={} host='localhost' user='user' password='password'".format(dbname)
return psycopg2.connect(connect_str)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment