Base Python Module

Pacifica Metadata ORM Base Class.

This class implements the basic functionality needed for all metadata objects in the metadata model for Pacifica.


Base class inherits from the PeeWee ORM Model class to create required fields by all objects and serialization methods for the base fields.

There are also CherryPy methods for creating, updating, getting and deleting these objects in from a web service layer.

class pacifica.metadata.orm.base.PacificaModel(*args, **kwargs)[source]

Basic fields for an object within the model.

Name Description
created When was the object created
updated When was the object last changed
deleted When was the object deleted

alias of PacificaModelDoesNotExist

static _bool_translate(thing)[source]

Translate the thing into a boolean.

static _date_operator_compare(date, kwargs, dt_converts=<function datetime_converts>)[source]
_meta = <peewee.Metadata object>
_schema = <peewee.SchemaManager object>
_set_date_part(date_part, obj)[source]
_set_datetime_part(time_part, obj)[source]
_set_only_if(key, obj, dest_attr, func)[source]
_set_only_if_by_name(attr, obj, cls)[source]
classmethod _where_attr_clause(where_clause, kwargs, keys)[source]

Grab keys and operators out of kwargs and return where clause.

classmethod available_hash_list()[source]

Generate a hashable structure of all keys and values of keys.

This structure allows for easy evaluation of updates or current vs old data for any object in the database.

classmethod cls_foreignkey_rel_mods()[source]

Return a collection of related models for a given foreignkey.

classmethod cls_foreignkeys()[source]

Provide the foreign keys of the class as a list of attrs.

classmethod cls_revforeignkeys()[source]

Provide the rev foreign keys of the class as a list of attrs.

created = <ExtendDateTimeField: PacificaModel.created>
deleted = <ExtendDateTimeField: PacificaModel.deleted>

Convert the hash objects into object fields if they are present.

static get_append_item(obj_ref, fk_item_name, fk_obj_list)[source]

Generate the proper item to append to the newly built object.

classmethod get_object_info(where_clause=None)[source]

Get model and field information about the model class.

classmethod get_primary_keys()[source]

Return the primary keys for the object.

id = <AutoField:>
classmethod last_change_date()[source]

Find the last changed date for the object.


Convert the base object fields into serializable attributes in a hash.

updated = <ExtendDateTimeField: PacificaModel.updated>
classmethod where_clause(kwargs)[source]

PeeWee specific extension meant to be passed to a PeeWee get or select.


Wrap a method with a database connect and close.