[sqlalchemy] Re: subquery and inheritance

2008-04-30 Thread Michael Bayer
On Apr 30, 2008, at 1:48 AM, kris wrote: > >> If I add a simple "correlate" feature to Query in 0.5, you can use >> the >> raw Table object to bypass the ORM meaning of "Dataset" and "Base". >> the query above is not quite complete but I can get an approximation >> like this: > > Is this funct

[sqlalchemy] Re: subquery and inheritance

2008-04-29 Thread kris
>If I add a simple "correlate" feature to Query in 0.5, you can use the >raw Table object to bypass the ORM meaning of "Dataset" and "Base". >the query above is not quite complete but I can get an approximation >like this: Is this functionality available currently or am I waiting for sqlalchemy 0

[sqlalchemy] Re: subquery and inheritance

2008-04-19 Thread Michael Bayer
On Apr 18, 2008, at 3:18 PM, kris wrote: > > select item.id > from item, > (select dataset_me.something_id > from (select * from base, dataset > where base.id = dataset.id and > base.owner="me") > as dataset_me > where >

[sqlalchemy] Re: subquery and inheritance

2008-04-19 Thread Michael Bayer
On Apr 18, 2008, at 10:42 PM, kris wrote: > > select * > from nodes, > (select node2_id as id2 > from assoc, >(select node2_id as id1 > from assoc where relation = 'is-a' >and node1_id = 100) >as isa > where

[sqlalchemy] Re: subquery and inheritance

2008-04-18 Thread kris
> > what I notice about both of these are that you're using correlations. > So right off , using the Query, which has opinions about how to build > select statements, to build up a statement like this with its current > functionality (as well as what we're planning to do in 0.5) is awkward > if n

[sqlalchemy] Re: subquery and inheritance

2008-04-18 Thread Michael Bayer
On Apr 18, 2008, at 3:18 PM, kris wrote: > I think I want something like the following: > > select item.id > from item, > (select dataset.something_id from base, dataset > where base.id = dataset.id and base.owner ='me' > tag.c.name="good" and tag.c.parent_id ==

[sqlalchemy] Re: subquery and inheritance

2008-04-18 Thread kris
The problem stems from a tree structure and creating self joins on a very large base table.. I am trying to create datasets of items and filter on the contents of datasets in single query that it built up progressively. base = Table ('base', Column('id', Integer, primarykey=True)

[sqlalchemy] Re: subquery and inheritance

2008-04-18 Thread Michael Bayer
On Apr 17, 2008, at 10:42 PM, kris wrote: > > I am building a tree structure of D1 and D2 nodes.. > > I am progressively generating a query as before execution using > subqueries. > > s = session.query(D1).filter (...)._values(D1.c.id).statement > ... > > q = session.query (D2).select_from (s).f