Brad Clements wrote:
On 12 Feb 2004 at 13:10, Michael Hobbs wrote:


Consider this example code:
departments = DepartmentTable
employees = EmployeeTable
johnsDepartment = (departments * employees) / (employees.dept == departments.dept) /
(employees.name == 'John') %
departments.name
print johnsDepartment[0].name


Has anyone tried expressing sql operations as relational algebra statements in Python, like the example above.

I see lots of talk in google, but no code.

Is this idea out of fashion already? I can see lots of performance issues.. but it's still interesting to me.

FWIW, SQLObject has some logic in place which mimics some of these ideas.

In general, I think you could work out a "compiler" which generates
SQL from the expression - you'd only need to define a set of special
objects that build a logical representation of the expression by
using the various hooks (__add__, __sub__, etc.).

I don't see any big performance issues, BTW, since you're basically
writing SQL in a slightly different way.

--
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jan 28 2005)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
_______________________________________________
DB-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/db-sig

Reply via email to