aboutsummaryrefslogtreecommitdiffstats
path: root/todb.py
diff options
context:
space:
mode:
authorDennis Eriksen <d@ennis.no>2023-02-01 20:32:11 +0100
committerDennis Eriksen <d@ennis.no>2023-02-01 20:32:11 +0100
commit8d186d39483beff64a1c11f80c6ca5e56dd7bbc5 (patch)
tree2c5a64ace4bd8eabd4d65014c5313bd7edd76191 /todb.py
parentrun queue in batches (diff)
downloadenergyscripts-8d186d39483beff64a1c11f80c6ca5e56dd7bbc5.tar.gz
moving and renaming/breaking everything
Diffstat (limited to 'todb.py')
-rw-r--r--todb.py22
1 files changed, 0 insertions, 22 deletions
diff --git a/todb.py b/todb.py
deleted file mode 100644
index 7426ace..0000000
--- a/todb.py
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env python3
-
-import os
-import psycopg
-
-pg_db = os.environ['el_pg_db']
-pg_host = os.environ['el_pg_host']
-pg_user = os.environ['el_pg_user']
-pg_pass = os.environ['el_pg_pass']
-
-def todb(sql, values):
- with psycopg.connect(dbname=pg_db, host=pg_host, user=pg_user, password=pg_pass) as conn:
- if type(values) == list:
- cur = conn.cursor()
- cur.executemany(sql, values)
- return cur.rowcount
- elif type(values) == tuple:
- conn.execute(sql, values)
- return 1
- else:
- print("OH SHIT")
- exit()