transaction-watcher/customer-list/querier.py

14 lines
342 B
Python
Raw Normal View History

2023-04-07 08:30:01 +00:00
from psycopg import Connection
def querier(conn: Connection) -> list[str]:
customer_list: list[str] = []
with conn.cursor() as cursor:
cursor.execute("SELECT DISTINCT customer_number FROM transactions")
for record in cursor:
customer_list.append(*record)
conn.commit()
return customer_list