Operators

The operator module defines two classes: class Operator derived from DbSchemaObject and class OperatorDict derived from DbObjectDict.

Operator

Operator is derived from DbSchemaObject and represents a PostgreSQL user-defined operator.

class pyrseas.dbobject.operator.Operator(schema, name, description=None, owner=None, privileges=None, **attrs)

An operator

Operator.extern_key()

Return the key to be used in external maps for this operator

Returns:string
Operator.qualname()

Return the schema-qualified name of the operator

Returns:string

No qualification is used if the schema is ‘public’.

Operator.identifier()

Return a full identifier for an operator object

Returns:string
Operator.create(obj, *args, **kwargs)

Return SQL statements to CREATE or REPLACE the operator

Returns:SQL statements

Operator Dictionary

OperatorDict is derived from DbObjectDict. It is a dictionary that represents the collection of operators in a database.

class pyrseas.dbobject.operator.OperatorDict(dbconn=None)

The collection of operators in a database

OperatorDict.from_map(schema, inopers)

Initalize the dictionary of operators by converting the input map

Parameters:
  • schema – schema owning the operators
  • inopers – YAML map defining the operators
OperatorDict.diff_map(inopers)

Generate SQL to transform existing operators

Parameters:inopers – a YAML map defining the new operators
Returns:list of SQL statements

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