From 2a4452e67f0d67900abc8275e9f7add0b4b9b356 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Fri, 24 Jan 2025 16:29:20 +0100 Subject: [PATCH] drop some obsolete files --- queries/recreate.sh | 10 ---------- src/main.py | 45 --------------------------------------------- 2 files changed, 55 deletions(-) delete mode 100755 queries/recreate.sh delete mode 100644 src/main.py diff --git a/queries/recreate.sh b/queries/recreate.sh deleted file mode 100755 index 2e5d9bd..0000000 --- a/queries/recreate.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - - -sv() { -cat pvec.sql | sed 's/%Y%/'$1'/' | sed 's/%M%/'$2'/' | sed 's/%D%/'$3'/' | psql -d udi-hottis -} - -sv 2025 01 02 - - diff --git a/src/main.py b/src/main.py deleted file mode 100644 index 57abcab..0000000 --- a/src/main.py +++ /dev/null @@ -1,45 +0,0 @@ -import psycopg -from loguru import logger - -def main(): - try: - conn = psycopg.connect() - logger.info("Database connection opened") - except Exception as e: - logger.error(f"Error when opening database connection {e}"( - return - - try: - with conn.cursor(cursor_factory=psycopg.extras.DictCursor) as cursor: - select_stmt = psycopg.sql.SQL(""" - SELECT ... - """) - cursor.execute(select_stmt, (...)) - row = cursor.fetchone() - - if not row: - logger.error(f"No data found") - return - - value = row["bla"] - - # calculation - insert_stmt = psycopg.sql.SQL(""" - INSERT ... - """) - cursor.execute(insert_stmt, (...)) - conn.commit() - - logger.info(f"Data successfully written to database") - except Exception as e: - logger.error(f"Error when selecting or writing database {e}") - conn.rollback() - finally: - conn.close() - logger.info("Database connection closed") - -if __name__ == "__main__": - main() - - -