Procedural Languages

The language module defines two classes, Language and LanguageDict, derived from DbObject and DbObjectDict, respectively.

Procedural Language

Language is derived from DbObject and represents a procedural language.

class pyrseas.dbobject.language.Language(name=None, description=None, owner=None, privileges=None, **attrs)

A procedural language definition

Language.to_map(no_owner, no_privs)

Convert language to a YAML-suitable format

Parameters:no_owner – exclude language owner information
Returns:dictionary
Language.create()

Return SQL statements to CREATE the language

Returns:SQL statements

Language Dictionary

LanguageDict is derived from DbObjectDict. It is a dictionary that represents the collection of procedural languages in a database. Internal languages (‘internal’, ‘c’ and ‘sql’) are excluded.

class pyrseas.dbobject.language.LanguageDict(dbconn=None)

The collection of procedural languages in a database.

LanguageDict.from_map(inmap)

Initialize the dictionary of languages by examining the input map

Parameters:inmap – the input YAML map defining the languages

Connect functions to their respective languages

Parameters:dbfunctions – dictionary of functions

Fills in the functions dictionary for each language by traversing the dbfunctions dictionary, which is keyed by schema and function name.

LanguageDict.diff_map(inlanguages)

Generate SQL to transform existing languages

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

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