Du måste binda sessionen till en SQLAlchemy-motor, inte direkt till ett MySQLDb-anslutningsobjekt.
engine = create_engine("mysql://user:example@sqldat.com/dbname")
Session.configure(bind=engine)
(Du kan ta bort din db1 variabel.)
Från handledningen:
Se även https://docs.sqlalchemy.org/en/latest/orm /tutorial.html