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 PostgreSQL cast.

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

A cast

static Cast.from_map(source, target, inobj)

Initialize a Cast instance from a YAML map

Parameters:
  • source – source type name
  • target – target type name
  • inobj – YAML map of the cast
Returns:

cast instance

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(obj, *args, **kwargs)

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)

Initalize the dictionary of casts by converting the input map

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