This repository has been archived on 2025-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
Files
RIS/App/Waybill/db/work.py
Anton Kamalov ee6a2f9756 Основной бизнес-процесс
Оформление накладных
2024-12-03 17:54:37 +03:00

16 lines
509 B
Python

from .DBconnect import DBContextManager
def select_list(db_config, sql) -> list:
with DBContextManager(db_config) as cursor:
if cursor is None:
raise ValueError("Cursor not created")
else:
cursor.execute(sql)
result = cursor.fetchall()
schema = [item[0] for item in cursor.description]
lst = [dict(zip(schema, row)) for row in result]
return lst
def transaction(cursor, sql):
cursor.execute(sql)
return True