In the following code, if I hit /testDbOne I get no errors, if I hit /testDbTWo I get the following error:
TypeError('testDbTwo() takes exactly 1 argument (0 given)',)
If I swap the position of engine1 and engine2, then testDbOne breaks and testDbTwo works. What am I doing wrong that I can't have SQLAlchemy create both sessions and install them into bottle as plugins?
Base = declarative_base()
#engine1
engine_s = create_engine('mysql://user:pass@localhost/dbone', echo=True)
create_session_s = sessionmaker(bind=engine_s)
bottle.install(SQLAlchemyPlugin(engine_s, Base.metadata, keyword="dbone"))
#engine2
engine = create_engine('mysql://user:pass@localhost/dbtwo', echo=True)
create_session = sessionmaker(bind=engine)
bottle.install(SQLAlchemyPlugin(engine, Base.metadata, keyword="dbtwo"))
#create the actual database sessions
dboneSession = create_session_s()
dbTwoSession = create_session()
@route("/testDbOne")
def testUserOne(dbone):
return "no error here"
@route("/testDbTwo")
def testDbTwo(dbtwo):
return "no error here"