This is my configurations.py
import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
import psycopg2
db_username = 'postgres'
db_password = 'postgres'
db_host = 'localhost'
db_name = 'testdb6'
engine = create_engine('postgresql+psycopg2://' + db_username + ':' + db_password + '@' + db_host +'/' + db_name,echo=True)
Session = sessionmaker()
Session.configure(bind=engine)
sess = Session()
Base = declarative_base()
I get an error when I try to import the sess variable.
Say, in a separate module, I try to do configurations.sess, I get a sess is not an attribute error. But configurations.Base works fine.
Where am I going wrong?
sess = Session()? Also, what isconfigurations? It's not in your code.