diff options
| author | user <user@node5.net> | 2024-04-07 18:08:45 +0200 |
|---|---|---|
| committer | user <user@node5.net> | 2024-04-07 18:08:45 +0200 |
| commit | 775409f83d77eb4f98fbcac9419b99721f5c7815 (patch) | |
| tree | 332cddcd0100ef27aa6971a35ddd8029678f9077 /src/db_handler.py | |
| parent | 21dd4d87554a8222bb84acdc7d22927923c60094 (diff) | |
derive colors from database, verify icons are in sync
Diffstat (limited to 'src/db_handler.py')
| -rw-r--r-- | src/db_handler.py | 9 |
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: |
