aboutsummaryrefslogtreecommitdiff
path: root/src/db_handler.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/db_handler.py')
-rw-r--r--src/db_handler.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/db_handler.py b/src/db_handler.py
index 5798c66..0fd3ec1 100644
--- a/src/db_handler.py
+++ b/src/db_handler.py
@@ -7,6 +7,15 @@ with open(os.path.join('configs', 'database.yml'), 'r') as file:
db_con_params = yaml.safe_load(file.read())
+def get_chains() -> (list[dict]):
+ with psycopg.connect(**db_con_params, row_factory=psycopg.rows.dict_row) as conn:
+ with conn.cursor() as cur:
+ cur.execute("""
+ SELECT name, color FROM chain
+ """)
+ chains = cur.fetchall()
+ return chains
+
def get_all() -> (list[dict]):
with psycopg.connect(**db_con_params, row_factory=psycopg.rows.dict_row) as conn:
with conn.cursor() as cur: