以下行声明了session
和from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
URL = 'mysql://root:pass@12.34.56.78/mydb'
engine = create_engine(URL, echo=False)
session = scoped_session(sessionmaker())
session.remove()
session.configure(bind=engine, autoflush=False, expire_on_commit=False)
个对象。
engine
我想知道如何使用session
和 2017-01-18T03:31:49.546164+00:00 app[web.1]: [d5ce2502-2cb9-4b1d-9888-f2990881bbb4] Completed 500 Internal Server Error in 16ms (ActiveRecord: 4.3ms)
2017-01-18T03:31:49.547115+00:00 app[web.1]: [d5ce2502-2cb9-4b1d-9888-f2990881bbb4] ActiveModel::UnknownAttributeError (unknown attribute 'deleted_at' for Stay.):
2017-01-18T03:31:49.547194+00:00 app[web.1]: [d5ce2502-2cb9-4b1d-9888-f2990881bbb4] app/controllers/stays_controller.rb:14:in `new'
对象来检查它们是否能够使用提供的URL,数据库名称和凭据连接到数据库。