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


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

class pyrseas.dbobject.rule.Rule(**attrs)

A rewrite rule definition


Return a full identifier for a rule object


Convert rule to a YAML-suitable format

Rule.create(obj, *args, **kwargs)

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:inmap – the input YAML map defining the rules

Generate SQL to transform existing rules

Parameters:input_map – a YAML map defining the new rules
Returns:list of SQL statements

Compares the existing rule definitions, as fetched from the catalogs, to the input map and generates SQL statements to transform the rules accordingly.