def setup_connection():
engine = create_engine("postgresql://postgres@localhost:5432/testdb", echo=False)
Session = sessionmaker(bind=engine)
sess = Session()
try:
Base.metadata.create_all(engine)
except Exception as e:
print("Could not initialize DB: {0}".format(e))
return sess
session = setup_connection()