On Apr 23, 2010, at 9:59 AM, Paul Balomiri <paulbalom...@gmail.com> wrote:

Hi,

Thanks, for your reply. I was aware that it is not just a string substitution,
and that the bindparams also maps the type of the parameters e.t.c.

But is it possible to supply a type /set of types which are or represent a lexical sub-structure ? I might go into doing it, but first i want to check that i'm not reinventing the wheel.

I noticed that the where clause can be supplied several times, so
select( [my_table_metadata]). where(....). where(...) is valid, thus it is possible for this special case to insert a logical expression after the initial select() definition.

I am looking for a similar, but more general case, not necessarily using bindparam where func.now() would be a valid substitution or insertion element into a preexisting expression.


Why not just create a python function that generatively produces the desired statement based on arguments? I don't see the advantage to something more magical than that.



regards
Paul Balomiri
paulbalom...@gmail.com



On 23.04.2010, at 15:26, Michael Bayer wrote:


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 .


--
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 .


--
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.

Reply via email to