3

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).

Maciej Piechotka
  • 6,571
  • 4
  • 35
  • 57

2 Answers2

5

I don't know about TurboGears, but you need to ensure that the engine's echo setting is set to True, e.g.

engine = sqlalchemy.create_engine('sqlite:///:memory:', echo=True)

By default, the echo setting is False, so queries aren't logged to stdout. It's possible that TG configures the two SA versions differently.

Vinay Sajip
  • 84,585
  • 13
  • 155
  • 165
3

Your configuration file should have the specified options. Look for those inside the development.ini

sqlalchemy.echo = true
sqlalchemy.echo_pool = true
amol
  • 1,609
  • 1
  • 10
  • 15
  • For some reasons it is writted `#echo shouldn't be used together with the logging module.` and the logging module does not work with 0.6. – Maciej Piechotka Jul 19 '11 at 01:33