mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
Nowy lepszy trunk
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user