cubicweb #1079123 Have a fetch_attr like feature for RQL requests [open]

The fetch_attr feature of the ORM is very interesting to optimize the number of queries performed within a single web request, and should be extended to plain RQL requests; a syntax similar to something like this would be great

self._cw.execute('Any U,C WHERE C is Comment, C owned_by U', complete=('U', 'C'))

This would use CWUser and Comment fetch_attrs attribute to automatically fetch the corresponding attributes/ relations and store them in the resulting rset cache and in the entities obtained by the entities() method.

Note that :

  • in case of etype ambiguity, this should still work
  • automatically complete all listed entities in the RQL would be my prefered default behaviour (complete='all' by default), that could be overridden using complete=()
done in<not specified>
closed by<not specified>