Extensions

The extension module defines two classes, Extension and ExtensionDict, derived from DbObject and DbObjectDict, respectively.

Extension

Extension is derived from DbObject and represents a PostgreSQL extension.

class pyrseas.dbobject.extension.Extension(name, description, owner, schema, version=None, oid=None)

An extension

static Extension.from_map(name, inobj)

Initialize an Extension instance from a YAML map

Parameters:
  • name – extension name
  • inobj – YAML map of the extension
Returns:

extension instance

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

Return SQL statements to CREATE the extension

Returns:SQL statements
Extension.alter(inobj, no_owner=True)

Generate SQL to transform an existing extension

Parameters:inobj – a YAML map defining the new extension
Returns:list of SQL statements

This exists because ALTER EXTENSION does not permit altering the owner.

Extension Dictionary

ExtensionDict is derived from DbObjectDict. It is a dictionary that represents the collection of extensions in a database.

class pyrseas.dbobject.extension.ExtensionDict(dbconn=None)

The collection of extensions in a database

ExtensionDict.from_map(inexts, langtempls, newdb)

Initalize the dictionary of extensions by converting the input map

Parameters:
  • inexts – YAML map defining the extensions
  • langtempls – list of language templates
  • newdb – dictionary of input database