Collations

The collation module defines two classes, Collation and CollationDict, derived from DbSchemaObject and DbObjectDict, respectively.

Collation

Collation is derived from DbSchemaObject and represents a PostgreSQL collation (available on PostgreSQL 9.1 or later).

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

A collation definition

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

Return SQL statements to CREATE the collation

Returns:SQL statements

Collation Dictionary

CollationDict is derived from DbObjectDict. It is a dictionary that represents the collection of collations in a database.

class pyrseas.dbobject.collation.CollationDict(dbconn=None)

The collection of collations in a database.

CollationDict.from_map(schema, inmap)

Initialize the dictionary of collations by examining the input map

Parameters:
  • schema – the schema owing the collations
  • inmap – the input YAML map defining the collations
CollationDict.diff_map(incolls)

Generate SQL to transform existing collations

Parameters:incolls – a YAML map defining the new collations
Returns:list of SQL statements

Compares the existing collation definitions, as fetched from the catalogs, to the input map and generates SQL statements to create, drop or change the collations accordingly.