Skip to content

Instantly share code, notes, and snippets.

@aniruddha27

aniruddha27/dbconnect.py

Last active Aug 15, 2020
Embed
What would you like to do?
# 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