leads-db/create_db.py

24 lines
478 B
Python

import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
# Connect to the default database
conn = psycopg2.connect(
dbname='postgres',
user='melkor',
password='Th3leetnis!leadsdb',
host='barad-dur.lan.mgk.one',
port='5433'
)
conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
cur = conn.cursor()
# Create the database
cur.execute('CREATE DATABASE leadsdb')
cur.close()
conn.close()
print("Database 'leadsdb' created successfully.")