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.

Source Distribution

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

Uploaded Source

File details

Details for the file rqlquery-0.4.0.tar.gz.

File metadata

  • Download URL: rqlquery-0.4.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rqlquery-0.4.0.tar.gz
Algorithm Hash digest
SHA256 d6818eb68edc99bce12a2236420aed79e80e3ad861ec147cb3584d1747ab4b7c
MD5 f4f9a9c24bd795980887b5a1a4a258c9
BLAKE2b-256 10e3973737d1b582bc6816041bb4c3e00f29e60f834f4efc8cfc193c0d3fd0a8

See more details on using hashes here.

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