I am trying to cut down on time the db spends compiling statements.
Using bind params
allows the query to look the same to the db, thus allowing it to not
parse it again. It's the
same use case that makes people want to use bind params anywhere. Am I
missing
something here? I'm a relative newbie to mysql and sqlalchemy, so I
may be missing information, but I'm
assuming that using a bindparam in sqlalchemy will result in a
prepared statement executed
using the assigned values that I want. If it is using a prepared
statement,
I'd expect the query to look something like
select * from table where limit=?

For Oracle, the rownum is simply part of the where clause, so I
wouldn't expect an issue with using
a bindparam for the limit.


On Sep 22, 8:09 am, Michael Bayer <[EMAIL PROTECTED]> wrote:
> "limit" is not really portable to all databases; in some cases
> (particularly Oracle) SQLAlchemy has to use some completely different
> syntaxes to come up with LIMIT.
>
> Additionally, the purpose of a bind parameter is to represent data
> that is compared against or inserted into a column expression.
> Whereas the LIMIT expression is part of the SQL construct
> itself...seems like PG and sqlite both allow it though but im not
> sure how oracle, mssql can deal with it (im pretty sure mysql allows
> it).
>
> more importantly whats the use case here ?  just trying to cut down
> on the time SQLAlchemy spends compile statements ?
>
> On Sep 18, 2007, at 5:30 PM, dykang wrote:
>
>
>
> > Hi,
>
> > I was trying to write a query where the limit clause was actually a
> > bind param, however it appears that, (in 3.10), this isn't possible.
> > Am I missing something, or is this a bug?
>
> > for example I'm just doing
> > s = select ([Table], whereclause, limit=bindparam('mylimit'))
> > s.execute(mylimit=5)
>
> > Can someone tell me if this is not a supported behavior, or what I
> > need to do for this to work?
>
> > Thanks,
> > D


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