# Path: plenario/settings.py
# DATABASE_CONN = 'postgresql://{}:{}@{}:{}/{}'.format(DB_USER, DB_PASSWORD, DB_HOST, DB_PORT, DB_NAME)
# 
# REDSHIFT_CONN = 'postgresql://{}:{}@{}:{}/{}'.format(RS_USER, RS_PASSWORD, RS_HOST, RS_PORT, RS_NAME)


import subprocess
from contextlib import contextmanager
from logging import getLogger
from sqlalchemy import create_engine
from sqlalchemy.engine.base import Engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session
from plenario.settings import DATABASE_CONN, REDSHIFT_CONN




logger = getLogger(__name__)


postgres_engine = create_engine(DATABASE_CONN)
postgres_session = scoped_session(sessionmaker(bind=postgres_engine))
postgres_base = declarative_base(bind=postgres_engine)
postgres_base.query = postgres_session.query_property()


# Path: plenario/settings.py
# DATABASE_CONN = 'postgresql://{}:{}@{}:{}/{}'.format(DB_USER, DB_PASSWORD, DB_HOST, DB_PORT, DB_NAME)
# 
# REDSHIFT_CONN = 'postgresql://{}:{}@{}:{}/{}'.format(RS_USER, RS_PASSWORD, RS_HOST, RS_PORT, RS_NAME)


# Path: plenario/database.py
import subprocess
from contextlib import contextmanager
from logging import getLogger
from sqlalchemy import create_engine
from sqlalchemy.engine.base import Engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session
from plenario.settings import DATABASE_CONN, REDSHIFT_CONN





logger = getLogger(__name__)


postgres_engine = create_engine(DATABASE_CONN)
postgres_session = scoped_session(sessionmaker(bind=postgres_engine))
postgres_base = declarative_base(bind=postgres_engine)
postgres_base.query = postgres_session.query_property()


redshift_engine = create_engine(REDSHIFT_CONN, max_overflow=-1)