[Cubicweb] some cubicweb goals for 2010

Nicolas Chauvat nicolas.chauvat at logilab.fr
Mon Apr 26 12:24:25 CEST 2010


Hi,

On Mon, Apr 26, 2010 at 10:32:53AM +0200, Sylvain Thénault wrote:
> On 25 avril 22:40, Florent Cayré wrote:
> > * improve the ORM : I really like the combination of the ORM +
> > fetch_attrs, fetch_order to get pre-completed and ordered entities but
> > ...
> 
> Regarding ORM improvments, the pb is that we've no way to now
> what to you intend to do when you access entity.relation. Getting
> this would requires advanced magic tricks or new apis. Also, have
> you mesured performance penalty ?

[no sure I am on topic, but...]

I never liked the ORM implicit query writing of Django or
SQLAlchemy. When you want to be precise and efficient, you need a
query language to make your request explicit. In CubicWeb, that's
RQL.

If you need something simple, use the ORM, if you need something more
complex, use RQL.

If your request is "I would like it to be very simple to switch from
the ORM objects to RQL queries", that's different.

We already have it working for turning a resultset into objects:

  entities = _cw.execute('Any X WHERE X is Ticket').entities()

what I would like to have is the ability to apply views to lists of
objects, like:

  project = _cw.entity_from_eid(1234)
  tickets = project.reverse_done_in
  self.wview('table', tickets, 'null')

or the ability to get the RQL for a list of objects, like:

  project = _cw.entity_from_eid(1234)
  tickets = project.reverse_done_in
  self.build_url(rql=tickets.rql)

or make it easier to manipulate rql queries, like:

  project = _cw.entity_from_eid(1234)
  tickets = project.reverse_done_in
  rql = tickets.rql.add('T in_state "open"') # lots of open questions here
  
-- 
Nicolas Chauvat

logilab.fr - services en informatique scientifique et gestion de connaissances  



More information about the Cubicweb mailing list