I have the following function:
def _init_db() -> "sqlalchemy.orm.session.Session":
engine = create_engine("sqlite:///my_db.db")
Base.metadata.create_all(engine)
# Creating Session
from sqlalchemy.orm import sessionmaker
Session = sessionmaker(bind = engine)
session = Session()
return session
Running mypy on the code gives me this error
error: Name 'sqlalchemy' is not defined
I tried with and without the quotes around sqlalchemy.orm.session.Session
How can I add type hints for sqlalchemy classes? What am I missing?