From cfb26d95a4e09d22f9845c449e81cea0e38f5236 Mon Sep 17 00:00:00 2001 From: Migatu Date: Fri, 8 Mar 2024 16:57:38 +0100 Subject: [PATCH] Nowy lepszy trunk --- import_to_postgres.py | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 import_to_postgres.py diff --git a/import_to_postgres.py b/import_to_postgres.py deleted file mode 100644 index bab791c..0000000 --- a/import_to_postgres.py +++ /dev/null @@ -1,33 +0,0 @@ -import netrc - -import psycopg2 - -NETRC_FILE = "" -NETRC_FILE = "/home/mtuszowski/.netrc" -# NETRC_FILE = "/home/pi/.netrc" -# NETRC_FILE = "C:\\Users\\mtusz\\.netrc" - -netrc_mod = netrc.netrc(NETRC_FILE) -REMOTE_HOST_NAME = "sql_localhost" -authTokens = netrc_mod.authenticators(REMOTE_HOST_NAME) - -# Connect to your postgres DB -conn = psycopg2.connect( - database="scihubdois", - host="localhost", - # trunk-ignore(mypy/index) - user=authTokens[0], - # trunk-ignore(mypy/index) - password=authTokens[2], - port="5432", -) - -# Open a cursor to perform database operations -cur = conn.cursor() - -# Execute a query -cur.execute("SELECT * FROM version()") - -# Retrieve query results -records = cur.fetchall() -print(records)