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/db/select.py
Anton Kamalov 339a55f8da Запрос по материалу заготовки
Доработать возвращение в меню запросов
2024-10-22 00:09:35 +03:00

12 lines
438 B
Python

from .DBconnect import DBContextManager
def select_list(db_config, sql):
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 schema, lst