Thanks! That is good to know. Having trouble finding the docs for psycopg2 -- any idea off the top of your head what the escape syntax is for %? (When I put in '%%', pyscopg2 outputted %%, not %, to postgres (but didn't throw the exception)).
I found the home page for pyscopg2 but no docs. http://initd.org/projects/psycopg2 -Mark On Sep 17, 10:31 am, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Sep 17, 2008, at 9:19 AM, Mark Mitchell wrote: > > > The code to replicate this exception is pretty simple: > > > count = con.scalar(select(['count(*)'], from_obj=my_table, > > whereclause=text('mytable.column > > like \'0000%\'')) > > > That is my error, here is my solution: > > > count = con.scalar(select(['count(*)'], from_obj=my_table, > > whereclause=text('mytable.column > > like \'0000%%\'')) > > psycopg2's paramstyle is %(name)s, so the % needs escaping. to > replicate: > > import psycopg2 > > conn = psycopg2.connect(user='scott', password='tiger', database='test') > cursor = conn.cursor() > cursor.execute("SELECT count(*) WHERE mytable.column like '0000%'", {}) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
