On Apr 23, 2010, at 6:58 AM, Paul Balomiri wrote: > Hi, > > Several days ago i has a similar question, which > was, perhaps a bit too theoretical. Here is a simple case: > > select(text(select * from f(:time)) ) > > can I supply alternatively either > {time: datetime.datetime(1999,9,9,9,9,9)} > or > {time: " now()"} > I cannot get around that sqlalchemy interprets " now()" as a string, while i > try to use the postgres(or other backends) now() function.
bind parameters exist only for the purpose of specifying literal data to be injected as the values into a SQL statement. They cannot be used to modify the lexical structure of a statement. So a lexical unit like "CURRENT TIMESTAMP" or "NOW()" is part of the statement's lexical source and cannot be injected as a bind parameter. To put it another way, bind parameters are not just string substitutions the way something like "foo %s" % ('bar') is in Python, even though they may look that way. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@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.