Conversions

The conversion module defines two classes, Conversion and ConversionDict, derived from DbSchemaObject and DbObjectDict, respectively.

Conversion

Conversion is derived from DbSchemaObject and represents a PostgreSQL conversion between character set encodings.

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

A conversion definition

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

Return SQL statements to CREATE the conversion

Returns:SQL statements

Conversion Dictionary

ConversionDict is derived from DbObjectDict. It is a dictionary that represents the collection of conversions in a database.

class pyrseas.dbobject.conversion.ConversionDict(dbconn=None)

The collection of conversions in a database.

ConversionDict.from_map(schema, inmap)

Initialize the dictionary of conversions by examining the input map

Parameters:
  • schema – the schema owing the conversions
  • inmap – the input YAML map defining the conversions
ConversionDict.diff_map(inconvs)

Generate SQL to transform existing conversions

Parameters:inconvs – a YAML map defining the new conversions
Returns:list of SQL statements

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