Skip to content

Instantly share code, notes, and snippets.

@aniruddha27
Last active August 15, 2020 07:02
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 aniruddha27/70099e5c18917e1b8449a67bf60ca87d to your computer and use it in GitHub Desktop.
Save aniruddha27/70099e5c18917e1b8449a67bf60ca87d to your computer and use it in GitHub Desktop.
# Connecting to the Database
def DbConnect(query):
conn = psycopg2.connect(host="localhost",database="TwitterDB",port=5432,user=<user>,password=<password>)
curr = conn.cursor()
curr.execute(query)
rows = curr.fetchall()
return rows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment