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 sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to