> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
On Behalf Of jack2318
> Sent: 11 June 2008 17:50
> To: sqlalchemy
> Subject: [sqlalchemy] text
>
>
> I tried very simple test:
>
> s = text("SELECT COUNT(*) FROM table WHERE field LIKE 'something'")
> count = conn.execute(s).fetchone()
>
> and this produced error
> Unexpected error: <type 'exceptions.TypeError'> not enough arguments
> for format string
>
> not big deal there is few way around but just for completeness I
> believe it should work (no parameters to expand)
>
> regards
> -- jacek
> PS: I am using mysql
Are you sure you didn't try:
s = text("SELECT COUNT(*) FROM table WHERE field LIKE 'something%'")
Ie. Included a percent sign in the query?
I think that sql strings get passed through python's % substitution
function at some point in SQLAlchemy (or possibly the DBAPI driver), so
you need to use '%%' instead of '%'.
Hope that helps,
Simon
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---