Skip to main content

Experimental ORM Query object

Project description


Experimental ORM Query object

The idea is to make RQL requests building simpler, and all with pythonic syntax.

It borrows a lot from the SQLAlchemy ORM.


Basic query with no filtering


CWUser = vreg[‘etypes’].etype_class(‘CWUser’) CWGroup = vreg[‘etypes’].etype_class(‘CWGroup’)

q = req.query(CWUser) assert q.torql(), (“Any X WHERE X is CWUser”, {})


Same with attribute eagerloading:

q = req.query(CWUser).eagerload('login')

With filtering:

q = req.query(CWUser)
q = q.filter(CWUser.in_group.filter( == u'managers'))

More complex filtering:

import datetime as dt

q = req.query(CWUser)
q = q.filter(
    (CWUser.creation_date >= - dt.timedelta(30))
    & CWUser.in_group.filter(
        ( == u"users")))

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rqlquery-0.4.0.tar.gz (8.1 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page