import psycopg2
try:
host = "11.167.252.45"
port = 3433
account = "testacc"
password = "wkl_test123"
connect_timeout= 3
options = "-c DateStyle=ISO"
conn = psycopg2.connect(host=host,
port=int(port),
user=account,
password=password,
database='postgres',
connect_timeout=connect_timeout,
options=options)
conn.autocommit = True
cursor = conn.cursor()
cursor.execute("/* rds internal mark */ select 1")
result = cursor.fetchall()
print(result)
except Exception as e:
print(e)
finally:
if conn:
conn.close()