File size: 446 Bytes
776aa28
 
 
 
 
 
 
98dbe3e
 
 
 
776aa28
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
);
""")