0
, 나는/testDbOne를 치면 내가/testDbTWo를 치면 내가 오류를 얻을 다음과 같은 에러가 나는 엔진 1과 engine2의 위치를 바꿀 경우병 및 SQLAlchemy의 여러 데이터베이스에 다음 코드에서
TypeError('testDbTwo() takes exactly 1 argument (0 given)',)
을 , 그런 다음 testDbOne이 중단되고 testDbTwo가 작동합니다. SQLAlchemy에서 두 세션을 모두 생성하여 병으로 플러그인으로 설치할 수 없다는 것은 잘못된 것입니까?
Base = declarative_base()
#engine1
engine_s = create_engine('mysql://user:[email protected]/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:[email protected]/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"