| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Dreaming About Redesigning SQL
alfredo_at_ncs.es (Alfredo Novoa) writes:
> pobrien_at_orbtech.com (Patrick K. O'Brien) wrote in message news:<m2pth33gj6.fsf_at_orbtech.com>...
>
> > > Lauri was not talking about trivial queries like "select * from A"
> >
> > Lauri made a blanket statement. I made a clarifying statement. I
> > can think of lots of trivial examples of a "standard SQL-query
> > with sorting and grouping and some joins." The "equivalent
> > result" in Python would not "require several pages of hand written
> > code." I stand by my original statement.
>
> It is false. A simple SQL query with several joins, extensions and a
> summarize would be equivalent to several pages of error prone and
> tedious hand written code, and of course the oportunities for
> optimization are lost.
group = {}
for od in db.root['OrderDetail']:
key = (od.order.customer.name, od.product.name)
subtotal = od.quantity * od.product.price
group[key] = group.get(key, 0) + subtotal
totals = [(t, c, p) for ((c, p), t) in group.items()]
totals.sort()
This is the code that satisfies Lauri's example. It doesn't look like several pages of error prone and tedious hand written code to me. So who is making false statements?
-- Patrick K. O'Brien Orbtech http://www.orbtech.com/web/pobrien ----------------------------------------------- "Your source for Python programming expertise." -----------------------------------------------Received on Mon Oct 13 2003 - 13:08:37 CDT
![]() |
![]() |