Skip to main content

Experimental ORM Query object

Project description

Summary

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.

Examples

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”, {})

q.all()

Same with attribute eagerloading:

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

With filtering:

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

More complex filtering:

import datetime as dt

q = req.query(CWUser)
q = q.filter(
    (CWUser.creation_date >= dt.date.now() - dt.timedelta(30))
    & CWUser.in_group.filter(
        (CWGroup.name == 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.

Files for rqlquery, version 0.4.0
Filename, size File type Python version Upload date Hashes
Filename, size rqlquery-0.4.0.tar.gz (8.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page