Mitch Skinner wrote:
>
> I'm a little confused, are we talking about the same thing?  I'm looking
> at OracleCompiler.visit_select:
>
>             if select.limit is not None:
>                 limitselect.append_whereclause("rownum<%d" %
> select.limit)
>             if select.offset is not None:
>                 limitselect.append_whereclause("rownum>%d" %
> select.offset)
>
> What I'm saying is that "rownum>%d" is going to eat up all of the result
> rows.  The 10.1 documentation for rownum says:

yes, I know, the code does not work at the moment for "offset"....it was
just a first stab at putting a limit/offset function in.   the query
returned with an argument like "limit=10" is this:

   select * from (select [original select statement]) where rownum < 10

which wont work for OFFSET.  what I probably had in mind was this:

   select * from (select [original columns], rownum as FOO) where FOO > 10

which does seem to work for both limit and offset, but requires some more
code mangling to get the extra column in there.  Since you have
enlightened me that row_number() is more the "official" way, I will look
into that, which involves a similar syntactical adjustment (i.e., add more
clauses in the inner select list, wrap the whole thing in a bigger
select).

The larger issue here is that the nesting of the select statements
produces other issues when the query is further wrapped in some of the
large scale queries generated by mappers, and I seem to recall there was
at least one mapper feature that is broken in that case.  I'll revisit and
create a ticket for it.




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to