Updated db.py
This commit is contained in:
parent
ace06a855c
commit
ebfc76f17b
1 changed files with 2 additions and 2 deletions
|
@ -16,7 +16,7 @@ class Database:
|
||||||
if not inspect(self.engine).has_table(table_name):
|
if not inspect(self.engine).has_table(table_name):
|
||||||
self.meta.create_all(self.engine)
|
self.meta.create_all(self.engine)
|
||||||
|
|
||||||
def set(self, user: str, values: dict):
|
def set_user(self, user: str, values: dict):
|
||||||
with self.engine.connect() as conn:
|
with self.engine.connect() as conn:
|
||||||
stmt = select(self.table).where(self.table.c.name == user)
|
stmt = select(self.table).where(self.table.c.name == user)
|
||||||
cnt = len(conn.execute(stmt).fetchall())
|
cnt = len(conn.execute(stmt).fetchall())
|
||||||
|
@ -28,7 +28,7 @@ class Database:
|
||||||
))
|
))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
def get(self, user: str, index: int):
|
def get_user(self, user: str, index: int):
|
||||||
with self.engine.connect() as conn:
|
with self.engine.connect() as conn:
|
||||||
stmt = select(self.table).where(self.table.c.name == user)
|
stmt = select(self.table).where(self.table.c.name == user)
|
||||||
cnt = len(conn.execute(stmt).fetchall())
|
cnt = len(conn.execute(stmt).fetchall())
|
||||||
|
|
Loading…
Add table
Reference in a new issue