如何验证会话和引擎对象是否能够连接

时间:2017-01-18 03:58:43

标签: python sqlalchemy

以下行声明了sessionfrom 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,数据库名称和凭据连接到数据库。

0 个答案:

没有答案