mlops_postgres / test_pg.py
Anuj-Panthri's picture
updated
98dbe3e
raw
history blame contribute delete
446 Bytes
import os
import dotenv
import psycopg2
dotenv.load_dotenv()
conn = psycopg2.connect(
# host="anuj-panthri-mlops-postgres.hf.space",
# port=443,
host="localhost",
port=5432,
user=os.environ["POSTGRES_USER"],
password=os.environ["POSTGRES_PASSWORD"],
database=os.environ["POSTGRES_DB"],
connect_timeout=5,
)
conn.autocommit = True
curr = conn.cursor()
curr.execute("""
CREATE TABLE friend(
name char
);
""")