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)