[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-14 Thread lei you
sorry about the flood... this should have the limit/offset is None case fixed. On 15/07/07, lei you <[EMAIL PROTECTED]> wrote: > > fixed a bug that exists if limit isn't specified. > > things should be fine now... > > On 15/07/07, lei you <[EMAIL PROTECTED]> wrote: > > > > the line > > > > orderby

[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-14 Thread lei you
fixed a bug that exists if limit isn't specified. things should be fine now... On 15/07/07, lei you <[EMAIL PROTECTED]> wrote: > > the line > > orderby = wrapper.order_by_clause = sql.ClauseList(*map( > wrapper.corresponding_column, select.order_by_clause.clauses)) > > should most be > > orderby

[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-14 Thread lei you
the line orderby = wrapper.order_by_clause = sql.ClauseList(*map( wrapper.corresponding_column, select.order_by_clause.clauses)) should most be orderby = sql.ClauseList(*map(wrapper.corresponding_column, select.order_by_clause.clauses)) not exactly sure why i did that... new diff attached On

[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-14 Thread lei you
what is sql generated for the proper fix? attached is a patch that attempts the wrapper solution. (seems to work for both union/non-union selects) it basically does the following. wrap the original select (be it union or not) in _msorg if the original select has an order_by_clause, adapt the

[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-14 Thread Michael Bayer
On Jul 14, 11:15 pm, "lei you" <[EMAIL PROTECTED]> wrote: > # TODO: put a real copy-container on Select and copy, or somehow make this > # not modify the Select statement > > In the above comments, are we referring to a solution where the original > select statement is wrap inside another select

[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-14 Thread lei you
# TODO: put a real copy-container on Select and copy, or somehow make this # not modify the Select statement In the above comments, are we referring to a solution where the original select statement is wrap inside another select statement where the actual row_number function is applied? On 15/07

[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-14 Thread lei you
Not exactly sure about what Valentin is doing there, will need to take a look at the actual schema and data involved, select distinct path, row_number() over (order by path desc) as ora_rn from Block row_number() is always distinct, therefore, the results returned by the above query will include

[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-13 Thread Michael Bayer
On Jul 13, 2007, at 4:20 AM, lei you wrote: > Thank you for the extremely speedy response :) > > Are we aware of any other impacts of oracle's offset+limit > implication? it has issues with DISTINCT as well. there is ticket #536 for this which I spent some time with but not enough to under

[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-13 Thread lei you
Thank you for the extremely speedy response :) Are we aware of any other impacts of oracle's offset+limit implication? On 13/07/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > > > On Jul 13, 2007, at 4:07 AM, Esceo wrote: > > > > > Hi all, > > > > attached is an experimental patch for mssql.py

[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-13 Thread Michael Bayer
On Jul 13, 2007, at 4:07 AM, Esceo wrote: > > Hi all, > > attached is an experimental patch for mssql.py merged with r2891: > > this is a direct steal from the oracle implementation of limit + > offset using row_number() > > what I would like to find out are the following: > > the oracle impleme

[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-13 Thread lei you
Patch is attached again --~--~-~--~~~---~--~~ 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 PROTECT

[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-13 Thread Esceo
Hi all, attached is an experimental patch for mssql.py merged with r2891: this is a direct steal from the oracle implementation of limit + offset using row_number() what I would like to find out are the following: the oracle implementation has visit_compound_select marked as todo, what is the

[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-10 Thread BruceC
Thank you all for looking into this - most appreciated! On Jul 10, 6:13 pm, "Paul Johnston" <[EMAIL PROTECTED]> wrote: > Hi, > > if 2005 supports ROW_NUMBER() OVER ORDER BY like oracle does, then yes > > > this could be a possible feature enhancement. > > Another approach that occured to me is do

[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-10 Thread Paul Johnston
Hi, if 2005 supports ROW_NUMBER() OVER ORDER BY like oracle does, then yes > this could be a possible feature enhancement. > Another approach that occured to me is doing TOP (limit+offset) then seeking the cursor. For server-side cursors this is probably nearly as efficient as LIMIT/OFFSET. I've

[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-09 Thread Michael Bayer
On Jul 10, 1:28 am, Philip Jenvey <[EMAIL PROTECTED]> wrote: > There are a few different workarounds for the lack of offset in SQL > Server, I recall a popular one being to nest your query in a couple > SELECT TOPs, basically manually plucking the data out yourself. > > Though it looks like SQL

[sqlalchemy] Re: Pagination problems using SQLAlchemy & MSSQL in Pylons - no OFFSET

2007-07-09 Thread Philip Jenvey
On Jul 9, 2007, at 9:37 PM, BruceC wrote: > > Hi all, I am using Pylons, & SQLAlchemy (via PYODBC) to connect > through to an MSSQL database. In particular, I have been trying to use > Christoph Haas' alternative Paginator (http://workaround.org/pylons/ > paginator/paginator.html) webhelper, whi