Is there any reason why session_factory method includes the create_all() statement? Why not use the create_all() globally just below Base is created?
def session_factory():
Base.metadata.create_all(engine) # why is this a part of session_factory
return _SessionFactory()
I'm using sqlalchemy with my Flask application and getting intermittent "MySQL server has gone away" error on the create_all() line. I believe due to inactivity Base doesn't exist anymore. Your thoughts?
Is there any reason why
session_factorymethod includes thecreate_all()statement? Why not use thecreate_all()globally just belowBaseis created?I'm using sqlalchemy with my Flask application and getting intermittent "MySQL server has gone away" error on the
create_all()line. I believe due to inactivityBasedoesn't exist anymore. Your thoughts?