Use session factory instead of engine for sqlalchemy.