Добавил модули
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import psycopg2 as pg
|
||||
|
||||
class Storage:
|
||||
def __init__(self, host, port, database, user, password):
|
||||
self.connection = pg.connect(host=host, port=port, dbname=database, user=user, password=password)
|
||||
|
||||
def do(self, query, should_return=False):
|
||||
transaction = self.connection.cursor()
|
||||
transaction.execute(query)
|
||||
|
||||
self.connection.commit()
|
||||
|
||||
if should_return:
|
||||
return transaction.fetchall()
|
||||
|
||||
Reference in New Issue
Block a user