wdmmg.lib.view - Database Views

This module implements views on the database. These are computed when a view is applied and the results are stored as wdmmg.model.Entry instances in the database with the following attribues:

{'_aggregation': u'<string describing the view axes>',
 'is_aggregate': True}

so we can differentiate them from “normal” Entries.

class wdmmg.lib.views.View(dataset, name, label, dimension, breakdown=None, filters={})
apply_to(obj, filters)

Applies the view to all entities in the same collection of obj``(``obj.c) that match the query filter.

obj
a model object (instance of wdmmg.model.Base)
filter
a mongodb query spec
classmethod by_name(obj, name)

get a``View`` with the name name from the object

obj
a model object (instance of wdmmg.model.Base)
name
The name of the View

returns: An instance of View if the view could be found.

raises: ValueError if the view does not exist.

class wdmmg.lib.views.ViewState(obj, view, time)

fixme: undocumented

aggregates
available_views
filters
totals

Previous topic

wdmmg.lib.times - Convert dates to persistable date range structures

Next topic

Glossary

This Page