使用 sqlalchemy 0.6 记录查询
在turbogears 2.1 和sqlalchemy 0.7 中,来自控制台的查询被记录到stdout。然而我需要降级到 0.6,它们就不再出现了。日志记录的文档似乎是相同的,我在变更日志中找不到任何内容。如何登录sqlalchemy 0.6?
编辑 DBSession.bind.echo
设置为 False
。如果我将其设置为 True ,它就可以工作。知道如何正确设置它(我修改了 model/__init__.py
设置 engine.echo = True
)。
With turbogears 2.1 and sqlalchemy 0.7 the queries from console were logged out to stdout. However I needed to downgred to 0.6 and they no longer appear. Documentation of logging seems to be identical and I couldn't find anything in changelog. How to log in sqlalchemy 0.6?
EDIT The DBSession.bind.echo
is set to False
. If I set it to True
it works. Any idea how to set it correctly (I'v modified model/__init__.py
setting engine.echo = True
).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不了解 TurboGears,但您需要确保引擎的
echo
设置设置为True
,例如默认情况下,
echo
设置为False
,因此查询不会记录到标准输出。 TG 对两个 SA 版本的配置可能不同。I don't know about TurboGears, but you need to ensure that the engine's
echo
setting is set toTrue
, e.g.By default, the
echo
setting isFalse
, so queries aren't logged to stdout. It's possible that TG configures the two SA versions differently.您的配置文件应该具有指定的选项。查找
development.ini
中的内容Your configuration file should have the specified options. Look for those inside the
development.ini