mirror of
https://github.com/SrIzan10/starters.git
synced 2026-05-01 11:05:16 +00:00
20 lines
275 B
Python
20 lines
275 B
Python
#!/usr/bin/python3
|
|
import psycopg2
|
|
import os
|
|
|
|
try:
|
|
conn = psycopg2.connect("")
|
|
except:
|
|
print("Couldn't connect")
|
|
|
|
|
|
cur = conn.cursor()
|
|
try:
|
|
cur.execute("SELECT NOW()")
|
|
except:
|
|
print("Oops database fail")
|
|
|
|
rows = cur.fetchall()
|
|
for row in rows:
|
|
print(row)
|