Rules

The rule module defines two classes, Rule and RuleDict, derived from DbSchemaObject and DbObjectDict, respectively.

Rule

Rule is derived from DbSchemaObject and represents a Postgres rewrite rule.

class pyrseas.dbobject.rule.Rule(name, schema, table, description, event, instead=False, actions=None, condition=None, definition=None, oid=None)

A rewrite rule definition

Rule.identifier()

Return a full identifier for a rule object

Returns:string
Rule.to_map(db)

Convert rule to a YAML-suitable format

Returns:dictionary
Rule.create(dbversion=None)

Return SQL statements to CREATE the rule

Returns:SQL statements

Rule Dictionary

RuleDict is derived from DbObjectDict. It is a dictionary that represents the collection of rewrite rules in a database.

class pyrseas.dbobject.rule.RuleDict(dbconn=None)

The collection of rewrite rules in a database.

RuleDict.from_map(table, inmap)

Initialize the dictionary of rules by examining the input map

Parameters:
  • table – the input YAML map of the associated table
  • inmap – the input YAML map defining the rules