Casts

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

Cast

Cast is derived from DbObject and represents a Postgres cast.

A cast is identified externally as cast (<source_type> AS <target_type>).

class pyrseas.dbobject.cast.Cast(source, target, description, function, context, method, oid=None)

A cast from a source type to a target type

Cast.extern_key()

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

Returns:string
Cast.identifier()

Return a full identifier for a cast object

Returns:string
Cast.to_map(db, no_owner=False, no_privs=False)

Convert a cast to a YAML-suitable format

Returns:dictionary
Cast.create(dbversion=None)

Return SQL statements to CREATE the cast

Returns:SQL statements

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)

Initialize the dictionary of casts by converting the input map

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