Re: [sqlalchemy] with_comment() ?
On Jul 11, 2011, at 5:46 PM, Tarek Ziadé wrote: Hello We're using with_hint() to add comments to sql queries, but that'll be work only with selects. I guess I can do a compiler extension to be able to add a /* comment */ in my queries, but I was wondering: unless I missed something, wouldn't it be useful to have a with_comment() method to be able to add a comment to a select, insert or update statement ? It would be useful yes, as well as available on Query as we've had some requests for this. Assuming the format of SQL comments doesn't change much across backends, it would be an easy patch (with unit tests of course). Still unanswered is what commenting would be desirable for INSERT/UPDATE/DELETE emitted during a flush, if any. -- 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] with_comment() ?
On Tue, Jul 12, 2011 at 4:46 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 11, 2011, at 5:46 PM, Tarek Ziadé wrote: Hello We're using with_hint() to add comments to sql queries, but that'll be work only with selects. I guess I can do a compiler extension to be able to add a /* comment */ in my queries, but I was wondering: unless I missed something, wouldn't it be useful to have a with_comment() method to be able to add a comment to a select, insert or update statement ? It would be useful yes, as well as available on Query as we've had some requests for this. Assuming the format of SQL comments doesn't change much across backends, it would be an easy patch (with unit tests of course). I'll give it a look then.. Still unanswered is what commenting would be desirable for INSERT/UPDATE/DELETE emitted during a flush, if any. I would say no in my use case. For us, the main reason to comment queries is to track them easily in the sql logs, even if the query text changes over time -- we don't rely on automatic queries, sessions etc, Cheers -- Tarek Ziadé | http://ziade.org -- 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.
[sqlalchemy] with_comment() ?
Hello We're using with_hint() to add comments to sql queries, but that'll be work only with selects. I guess I can do a compiler extension to be able to add a /* comment */ in my queries, but I was wondering: unless I missed something, wouldn't it be useful to have a with_comment() method to be able to add a comment to a select, insert or update statement ? Cheers Tarek -- Tarek Ziadé | http://ziade.org -- 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.