The hardest part I guess is when we encounter a _TextClause based
order_by, assuming there is no builtin way to parse a _TextClause back
down to column, table desc etc...

On Jan 10, 6:47 pm, Esceo <[EMAIL PROTECTED]> wrote:
> Something more is probably needed.
>
> adding row_number will render a distinct clause useless...
>
> need to form an inner select with the original select, and at the same
> time, make sure the order_by clause of the row_number field gets
> rewritten,
>
> I had a patch for 0.3 (working in all the cases I've encountered), but
> I guess I should ask about how we may get the corresponding order_by
> clause in 0.4
>
> Lei
>
> On Nov 27 2007, 7:18 am, Michael Bayer <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > On Nov 26, 2007, at 2:25 PM, Paul Johnston wrote:
>
> > > Hi,
>
> > > Can someone (Mike?) give me a hand with this, I've hit the limits of  
> > > my
> > > understanding of the query compiler.
>
> > > The patch I've done on #638 (mostly copied from Oracle) creates a
> > > subquery with row_number if there is an OFFSET. It aliases the query,
> > > because MSSQL is funny about that, and it also attempts to move  
> > > ORDER BY
> > > from the inner to outer query (again, MSSQL is funny). Only problem is
> > > that it doesn't quite pick up the correct labelled name. Uncomment  
> > > this
> > > line in the patch to see the problem:
> > > #limitselect._order_by_clause = select._order_by_clause
>
> > > Any ideas would be a help (and a query compiler 101 document would  
> > > be fab!)
>
> > attached is a modified version of that patch which includes the unit  
> > test.  If the SQL isnt right, change the unit tests first to reflect  
> > what results you'd like to see, then we can try tweaking it.
>
> > the key feature used here is the "proxies" element on Column.  this is  
> > also a new feature, it was previously some nasty methodology before  
> > 0.4.1.
>
> > if i have a table:  create table sometable (a int, b int)
>
> > and then a select:    select a, b from sometable
>
> > and an aliased version of it:    (select a, b from sometable) as anon_1
>
> > you've got six columns in play.  you have table.a, table.b; you have  
> > select.a and select.b, and anon1.a and anon_1.b.  The "proxies"  
> > collection allows you to navigate from anon_1.a to select.a back to  
> > table.a; its a collection that in almost all cases has just one  
> > element (it only has multiple elements when a column is proxying a  
> > UNION or similar).  So that way you can navigate to the column which  
> > an aliased column "represents".
>
> >  mssql.638.patch
> > 4KDownload
>
> > - Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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