ORM Python Module

The ORM module defining the SQL model for notifications.

class pacifica.notifications.orm.BaseModel(*args, **kwargs)[source]

Auto-generated by pwiz.

DoesNotExist

alias of BaseModelDoesNotExist

_meta = <peewee.Metadata object>
_schema = <peewee.SchemaManager object>
classmethod atomic()[source]

Do the database atomic action.

classmethod database_close()[source]

Close the database connection.

Closing already closed database is not a problem, so continue on.

classmethod database_connect()[source]

Make sure database is connected.

Trying to connect a second time does cause problems.

id = <AutoField: BaseModel.id>
class pacifica.notifications.orm.EventLog(*args, **kwargs)[source]

Events matching via jsonpath per user.

DoesNotExist

alias of EventLogDoesNotExist

_meta = <peewee.Metadata object>
_schema = <peewee.SchemaManager object>
created = <DateTimeField: EventLog.created>
event_matches
jsondata = <TextField: EventLog.jsondata>
uuid = <UUIDField: EventLog.uuid>
class pacifica.notifications.orm.EventLogMatch(*args, **kwargs)[source]

Events matching via jsonpath per user.

DoesNotExist

alias of EventLogMatchDoesNotExist

_meta = <peewee.Metadata object>
_schema = <peewee.SchemaManager object>
created = <DateTimeField: EventLogMatch.created>
event_log = <ForeignKeyField: EventLogMatch.event_log>
event_log_id = <ForeignKeyField: EventLogMatch.event_log>
event_match = <ForeignKeyField: EventLogMatch.event_match>
event_match_id = <ForeignKeyField: EventLogMatch.event_match>
policy_resp_body = <TextField: EventLogMatch.policy_resp_body>
policy_status_code = <TextField: EventLogMatch.policy_status_code>
target_resp_body = <TextField: EventLogMatch.target_resp_body>
target_status_code = <TextField: EventLogMatch.target_status_code>
uuid = <UUIDField: EventLogMatch.uuid>
class pacifica.notifications.orm.EventMatch(*args, **kwargs)[source]

Events matching via jsonpath per user.

DoesNotExist

alias of EventMatchDoesNotExist

_meta = <peewee.Metadata object>
_schema = <peewee.SchemaManager object>
auth = <TextField: EventMatch.auth>
created = <DateTimeField: EventMatch.created>
deleted = <DateTimeField: EventMatch.deleted>
disabled = <DateTimeField: EventMatch.disabled>
error = <TextField: EventMatch.error>
event_logs
extensions = <TextField: EventMatch.extensions>
jsonpath = <TextField: EventMatch.jsonpath>
name = <CharField: EventMatch.name>
target_url = <TextField: EventMatch.target_url>
to_hash()[source]

Convert the object to a json serializable hash.

updated = <DateTimeField: EventMatch.updated>
user = <CharField: EventMatch.user>
uuid = <UUIDField: EventMatch.uuid>
validate_jsonpath()[source]

Validate the jsonpath string.

version = <CharField: EventMatch.version>
class pacifica.notifications.orm.NotificationSystem(*args, **kwargs)[source]

Notification Schema Version Model.

DoesNotExist

alias of NotificationSystemDoesNotExist

_meta = <peewee.Metadata object>
_schema = <peewee.SchemaManager object>
classmethod get_or_create_version()[source]

Set or create the current version of the schema.

classmethod get_version()[source]

Get the current version as a tuple.

classmethod is_equal()[source]

Check to see if schema version matches code version.

classmethod is_safe()[source]

Check to see if the schema version is safe for the code.

part = <CharField: NotificationSystem.part>
value = <IntegerField: NotificationSystem.value>
class pacifica.notifications.orm.OrmSync[source]

Special module for syncing the orm.

This module should incorporate a schema migration strategy.

The supported versions migrating forward must be in a versions array containing tuples for major and minor versions.

The version tuples are directly translated to method names in the orm_update class for the update between those versions.

Example Version Control:

class orm_update:
  versions = [
    (0, 1),
    (0, 2),
    (1, 0),
    (1, 1)
  ]

  def update_0_1_to_0_2():
      pass
  def update_0_2_to_1_0():
      pass

The body of the update should follow peewee migration practices. http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#migrate

static dbconn_blocking()[source]

Wait for the db connection.

classmethod update_0_0_to_1_0()[source]

Update by adding the new table.

classmethod update_1_0_to_2_0()[source]

Update by adding the auth column.

classmethod update_2_0_to_3_0()[source]

Update by adding the auth column.

classmethod update_tables()[source]

Update the database to the current version.

versions = [(0, 0), (1, 0), (2, 0), (3, 0)]
pacifica.notifications.orm.eventget(args)[source]

Get events based on command line argument in args.

pacifica.notifications.orm.eventpurge(args)[source]

Purge events based on command line argument in args.