The cast module defines two classes, Cast and CastDict, derived from DbObject and DbObjectDict, respectively.


Cast is derived from DbObject and represents a PostgreSQL cast.

class pyrseas.dbobject.cast.Cast(name=None, description=None, owner=None, privileges=None, **attrs)

A cast


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


Return a full identifier for a cast object

Cast.to_map(no_owner=False, no_privs=False)

Convert a cast to a YAML-suitable format

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

Return SQL statements to CREATE the cast

Returns:SQL statements
Cast.diff_map(inobj, no_owner=False)

Generate SQL to transform an existing object

  • inobj – a YAML map defining the new object
  • no_owner – exclude object owner information

list of SQL statements

Compares the object to an input object and generates SQL statements to transform it into the one represented by the input. This base implementation simply deals with owners and comments.

Cast Dictionary

CastDict is derived from DbObjectDict. It is a dictionary that represents the collection of casts in a database.

class pyrseas.dbobject.cast.CastDict(dbconn=None)

The collection of casts in a database

CastDict.from_map(incasts, newdb)

Initalize the dictionary of casts by converting the input map

  • incasts – YAML map defining the casts
  • newdb – collection of dictionaries defining the database

Generate SQL to transform existing casts

Parameters:incasts – a YAML map defining the new casts
Returns:list of SQL statements

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