# import psycopg2
from sqlalchemy import create_engine

with create_engine('postgresql://postgres:default@localhost/',
                       isolation_level="AUTOCOMMIT").connect() as connection:
    connection.execute('DROP DATABASE IF EXISTS reports;')
    connection.execute('CREATE DATABASE reports OWNER = postgres ENCODING = \'utf8\' TABLESPACE = pg_default;')

with create_engine('postgresql://postgres:default@localhost/reports',
                       isolation_level="AUTOCOMMIT").connect() as connection:
    connection.execute('''
            CREATE TABLE reports (
                id BIGSERIAL PRIMARY KEY,
                data JSONB,
                created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
                updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
            );
        ''')


# connection = psycopg2.connect(user = 'postgres', password = 'default', host = '127.0.0.1', port = '5432')
# cursor = connection.cursor()

# cursor.execute()

# connection.commit()
# connection.close