RE: [sqlalchemy] engine.echo not working as expected
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Mike Conley Sent: 27 July 2011 17:43 To: sqlalchemy@googlegroups.com Subject: [sqlalchemy] engine.echo not working as expected Under 0.5 I was able to turn echo on and off as desired to support debugging; it doesn't seem to work now. Python version: 2.7.1 SQLAlchemy version: 0.7.1 Here's the code: from sqlalchemy import * eng1 = create_engine('sqlite:///') meta1 = MetaData(bind=eng1) tab_a = Table('x', meta1, Column('id',Integer, primary_key=True)) meta1.create_all() conn = eng1.connect() conn.execute(tab_a.insert()) x=conn.execute(select([tab_a])).fetchone() eng1.echo=True conn.execute(tab_a.delete().where(tab_a.c.id==x.id)) Under 0.5.8 The SQL for the delete is echoed, under 0.7 (and I think 0.6) it is not. If I move the echo=True before the select, both the select and delete are echoed. It looks like there might be a subtle difference since 0.5 that keeps the logging from taking effect immediately when echo is changed. P.S. Now as I try to reverify it, I have to move the echo=True all the way before the connect() to get it to echo. This is explained in the note at the bottom of http://www.sqlalchemy.org/docs/core/engines.html#configuring-logging. (not that that necessarily helps you, but it does at least say that it is expected behaviour) Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] engine.echo not working as expected
I saw that, but unless setting echo actually changes the Python logger configuration I don't see how it applies here. -- Mike Conley On Wed, Jul 27, 2011 at 12:31 PM, King Simon-NFHD78 simon.k...@motorolasolutions.com wrote: -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Mike Conley Sent: 27 July 2011 17:43 To: sqlalchemy@googlegroups.com Subject: [sqlalchemy] engine.echo not working as expected Under 0.5 I was able to turn echo on and off as desired to support debugging; it doesn't seem to work now. Python version: 2.7.1 SQLAlchemy version: 0.7.1 Here's the code: from sqlalchemy import * eng1 = create_engine('sqlite:///') meta1 = MetaData(bind=eng1) tab_a = Table('x', meta1, Column('id',Integer, primary_key=True)) meta1.create_all() conn = eng1.connect() conn.execute(tab_a.insert()) x=conn.execute(select([tab_a])).fetchone() eng1.echo=True conn.execute(tab_a.delete().where(tab_a.c.id==x.id)) Under 0.5.8 The SQL for the delete is echoed, under 0.7 (and I think 0.6) it is not. If I move the echo=True before the select, both the select and delete are echoed. It looks like there might be a subtle difference since 0.5 that keeps the logging from taking effect immediately when echo is changed. P.S. Now as I try to reverify it, I have to move the echo=True all the way before the connect() to get it to echo. This is explained in the note at the bottom of http://www.sqlalchemy.org/docs/core/engines.html#configuring-logging. (not that that necessarily helps you, but it does at least say that it is expected behaviour) Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] engine.echo not working as expected
No Python logging calls are emitted, which means, log.info() and log.debug() *are not called at all*, if logging.isEnabledFor() returns False, which itself is only checked upon Connection construction. These calls are all unreasonably expensive so they aren't used if not necessary. That's what the paragraph means when it says only emitting log statements when the current logging level. On Jul 27, 2011, at 2:20 PM, Mike Conley wrote: I saw that, but unless setting echo actually changes the Python logger configuration I don't see how it applies here. -- Mike Conley On Wed, Jul 27, 2011 at 12:31 PM, King Simon-NFHD78 simon.k...@motorolasolutions.com wrote: -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Mike Conley Sent: 27 July 2011 17:43 To: sqlalchemy@googlegroups.com Subject: [sqlalchemy] engine.echo not working as expected Under 0.5 I was able to turn echo on and off as desired to support debugging; it doesn't seem to work now. Python version: 2.7.1 SQLAlchemy version: 0.7.1 Here's the code: from sqlalchemy import * eng1 = create_engine('sqlite:///') meta1 = MetaData(bind=eng1) tab_a = Table('x', meta1, Column('id',Integer, primary_key=True)) meta1.create_all() conn = eng1.connect() conn.execute(tab_a.insert()) x=conn.execute(select([tab_a])).fetchone() eng1.echo=True conn.execute(tab_a.delete().where(tab_a.c.id==x.id)) Under 0.5.8 The SQL for the delete is echoed, under 0.7 (and I think 0.6) it is not. If I move the echo=True before the select, both the select and delete are echoed. It looks like there might be a subtle difference since 0.5 that keeps the logging from taking effect immediately when echo is changed. P.S. Now as I try to reverify it, I have to move the echo=True all the way before the connect() to get it to echo. This is explained in the note at the bottom of http://www.sqlalchemy.org/docs/core/engines.html#configuring-logging. (not that that necessarily helps you, but it does at least say that it is expected behaviour) Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.