58 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: Integrating the ORM ...
FromSent OnAttachments
Phillip J. Eby26 Feb 2008 09:18 
sdob...@sistechnology.com26 Feb 2008 10:36 
Michael Bayer26 Feb 2008 11:05 
Phillip J. Eby26 Feb 2008 11:42 
Michael Bayer26 Feb 2008 12:27 
Michael Bayer26 Feb 2008 12:28 
sdob...@sistechnology.com26 Feb 2008 12:35 
sdob...@sistechnology.com26 Feb 2008 13:05 
jason kirtland26 Feb 2008 13:51 
Phillip J. Eby26 Feb 2008 14:27 
Phillip J. Eby26 Feb 2008 14:39 
Michael Bayer26 Feb 2008 14:44 
Michael Bayer26 Feb 2008 16:22 
Phillip J. Eby26 Feb 2008 17:07 
Phillip J. Eby26 Feb 2008 17:30 
Michael Bayer26 Feb 2008 17:39 
sdob...@sistechnology.com26 Feb 2008 22:05 
Michael Bayer26 Feb 2008 23:48 
sdob...@sistechnology.com26 Feb 2008 23:50 
svilen27 Feb 2008 04:58 
Judah De Paula27 Feb 2008 06:46 
Michael Bayer27 Feb 2008 07:22 
Michael Bayer27 Feb 2008 08:58.py
Judah De Paula27 Feb 2008 09:00 
Judah De Paula27 Feb 2008 09:05 
jason kirtland27 Feb 2008 09:19 
Michael Bayer27 Feb 2008 09:40 
Michael Bayer27 Feb 2008 10:06 
Phillip J. Eby27 Feb 2008 12:10 
Michael Bayer27 Feb 2008 13:03 
Michael Bayer27 Feb 2008 13:09 
sdob...@sistechnology.com27 Feb 2008 22:50 
sdob...@sistechnology.com27 Feb 2008 23:20 
Michael Bayer28 Feb 2008 07:18 
Michael Bayer28 Feb 2008 13:16 
Michael Bayer28 Feb 2008 13:19 
sdob...@sistechnology.com28 Feb 2008 13:25 
sdob...@sistechnology.com28 Feb 2008 13:38 
sdob...@sistechnology.com28 Feb 2008 14:15 
Phillip J. Eby28 Feb 2008 14:17 
Phillip J. Eby28 Feb 2008 14:26 
sdob...@sistechnology.com28 Feb 2008 14:37 
Michael Bayer28 Feb 2008 14:41 
Michael Bayer28 Feb 2008 14:48 
sdob...@sistechnology.com28 Feb 2008 15:22 
sdob...@sistechnology.com28 Feb 2008 15:38 
Phillip J. Eby28 Feb 2008 16:15 
Phillip J. Eby28 Feb 2008 16:26 
sdob...@sistechnology.com28 Feb 2008 22:59 
Phillip J. Eby29 Feb 2008 07:38 
Michael Bayer29 Feb 2008 09:55.patch
Phillip J. Eby29 Feb 2008 10:44 
Judah De Paula29 Feb 2008 11:08 
Phillip J. Eby03 Mar 2008 10:38.patch
Michael Bayer03 Mar 2008 11:03 
Phillip J. Eby04 Mar 2008 16:27 
Michael Bayer05 Mar 2008 07:42 
jason kirtland06 Mar 2008 14:41 
Subject:[sqlalchemy] Re: Integrating the ORM with Trellis
From:Phillip J. Eby (pj@telecommunity.com)
Date:02/26/2008 02:39:07 PM
List:com.googlegroups.sqlalchemy

At 01:52 PM 2/26/2008 -0800, jason kirtland wrote:

One of the services the SA descriptors provide is query construction via column/relation mappings:

query(Foo).filter(Foo.bar == 2).filter(Foo.children.any(Bar.age > 2))

Not having those would diminish the utility of the ORM in user code- querying based on higher-level relations would be lost.

Good point. I forgot about this because my long-term plan was to implement a similar capability for querying on Trellis objects (that are not stored in a DB). Integrating the two might be... interesting.

If combining descriptor functions is acceptable and the __eq__/__ne__ conflict can be resolved, I like Mike's suggestion about providing some get/set routing logic in the InstanceState. Any Trellis-managed attribute the ORM wanted to get or set could be directed to ob.__cells__[...].value; similarly, the combined Trellis/SA descriptor would maintain Trellis's __cell__ logic.

Yep.

The collections may able to bolt on almost as-is. The collections package provides decorators that emit add/remove events for the ORM. If mapped instances enter and leave the Trellis collections directly, then it's pretty trivial. If they go in and out wrapped in something, then some custom code may be needed. The collection descriptor also has some logic in its __set__ that would need to be preserved. It does the same thing I would imagine Trellis does for collections: orchestrate events on foo.attr = [b1, b2, b3] or foo.attr = foo.attr[2:].

Actually, CellProperty knows nothing about an attribute but its name, so it doesn't actually do anything special for cell attributes. However, a specialized cell could be used to do the same thing, so that's only a minor detail.