Skip to content

Instantly share code, notes, and snippets.

@esirK
Last active July 9, 2018 14:06
Show Gist options
  • Save esirK/abe035e0082089812ffc346d015d899b to your computer and use it in GitHub Desktop.
Save esirK/abe035e0082089812ffc346d015d899b to your computer and use it in GitHub Desktop.
import psycopg2
class Database:
def __init__(self, dbname, user, password):
self.conn = psycopg2.connect(database=dbname, user=user, password=password)
self.cur = self.conn.cursor()
def query(self, query):
self.cur.execute(query)
def close(self):
self.cur.close()
self.conn.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment