seed.managers package¶
Subpackages¶
Submodules¶
seed.managers.json module¶
:copyright (c) 2014 - 2016, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Department of Energy) and contributors. All rights reserved. # NOQA :author
Query JSON data from Postgres JsonFields.
BuildingSnapshot.objects.json_query(key='something')
BuildingSnapshot.objects.json_query(
key='thing', cond=">", value="2342", key_cast=int
)
BuildingSnapshot.objects.json_query(
key='Natural Gas Use (kBtu)', excludes=['Not Available']
)
BuildingSnapshot.objects.json_query(
key='Natural Gas Use (kBtu)', excluder='IS NOT', excludes=['NULL'],
)
# Here's an example using `LIKE` condition and chaining with other filters:
BuildingSnapshot.objects.json_query(
'Property Type', cond='LIKE', value='CONDO'
).filter(id__gt=1).count()
-
class
seed.managers.json.
JsonManager
¶ Bases:
django.db.models.manager.Manager
-
get_query_set
(*args, **kwargs)¶
-
get_queryset
()¶
-
-
class
seed.managers.json.
JsonQuerySet
(primary=None, *args, **kwargs)¶ Bases:
django.db.models.query.QuerySet
-
json_query
(key, value=None, cond=None, key_cast='text', unit=None, **kw)¶ Query JsonField data using simplified syntax.
See
build_extra
for parameter definitions. optional parameters pulled from kwargs: :param excludes: list of str, value conditions to avoid, applied first. :param field: str, if you’d like to override theself.primary
. :param order_by: str (optional), name of a key you want to order_by. :param order_by_rev: boolean (optional), whether to reverse or not.
-
Module contents¶
:copyright (c) 2014 - 2016, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Department of Energy) and contributors. All rights reserved. # NOQA :author