HTSQL 2.0 RC1 -- a Query Language for the Accidental Programmer
Kirill Simonov
xi at gamma.dn.ua
Sat Jan 22 12:20:07 EST 2011
On 01/22/2011 12:25 AM, rusi wrote:
> On Jan 22, 2:45 am, "Clark C. Evans"<c... at clarkevans.com> wrote:
>> Kirill Simonov and myself would like to introduce HTSQL, a novel
>> approach to relational database access which is neither an ORM nor raw SQL.
> :
>> We're curious what you think.
>
> Thanks -- looks interesting.
>
> Given the claim htsql is higher level than sql I am interested in
> bill-of-materials type (recursive) queries.
Currently HTSQL does not support recursive queries. That said, it's
certainly within the reach of HTSQL and I could sketch here how the
support may look like:
We add an operator `closure()` that, given a self-referential link
`link`, produces a transitive closure `closure(link)` of the link.
For example, take a table `program` with a link `program.part_of`. Then
`program.closure(part_of)` is a plural link mapping a program to its
super-programs, which you can use just like a regular plural link, for
instance, in aggregate expressions.
To return, for each program, a list of its super-programs:
/program{code, /closure(part_of){code}}
To return all sub-programs of a specific program 'xxx':
/program?exists(closure(part_of).code='xxx')
Compare that with
/program{code, part_of.code}
/program?part_of.code='xxx'
I think it would be a modest improvement over a SQL alternative.
I'm adding it to the roadmap right now, but don't hold your breath -- Q4
this year or early next year is a realistic ETA. I expect the
implementation to be at least moderately painful and, obviously, it
could only work with those backends that support WITH RECURSIVE.
Thanks,
Kirill
More information about the Python-list
mailing list