Fix module in terms of python style
This commit is contained in:
11
api/s1_title.py
Normal file
11
api/s1_title.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from psycopg.rows import dict_row
|
||||
from api.connection import g_conn_dict as conn
|
||||
|
||||
def set_title(name: str, value: str) -> None:
|
||||
with conn[name].cursor() as cur:
|
||||
cur.execute(f"update title set value = '{value}'")
|
||||
|
||||
def get_title(name: str) -> str:
|
||||
with conn[name].cursor(row_factory=dict_row) as cur:
|
||||
cur.execute(f"select * from title")
|
||||
return cur.fetchone()['value']
|
||||
Reference in New Issue
Block a user