Types and Domains

module: pyrseas.dbobject.dbtype

The dbtype module defines seven classes, DbType derived from DbSchemaObject, BaseType, Composite, Enum, Domain and Range derived from DbType, and TypeDict derived from and DbObjectDict.

Database Type

Class DbType is derived from ~pyrseas.dbobject.DbSchemaObject and represents a SQL type or domain as defined in the Postgres pg_type catalog.

autoclass: DbType

Base Type

BaseType is derived from ~pyrseas.dbobject.DbType and represents a Postgres user-defined base type.

The map returned by to_map and expected as argument by TypeDict.from_map has the following structure (not all fields need be present):

{'type t1':
    {'alignment': 'double',
     'analyze': 'analyze_func',
     'category': 'U',
     'delimiter': ',',
     'input': 'input_func',
     'internallength': 'variable',
     'output': 'output_func',
     'preferred': 'true',
     'receive': 'receive_func',
     'send': 'send_func',
     'storage': 'plain'
     'typmod_in': 'typmod_in_func',
     'typmod_out': 'typmod_out_func'
    }
}
autoclass: BaseType

automethod: BaseType.to_map

automethod: BaseType.create

automethod: BaseType.drop

Composite

Composite is derived from ~pyrseas.dbobject.DbType and represents a standalone composite type.

autoclass: Composite

automethod: Composite.to_map

automethod: Composite.create

automethod: Composite.alter

Enum

Enum is derived from ~pyrseas.dbobject.DbType and represents an enumerated type.

autoclass: Enum

automethod: Enum.create

Domain

Domain is derived from ~pyrseas.dbobject.DbType and represents a domain.

autoclass: Domain

automethod: Domain.to_map

automethod: Domain.create

Range

Range is derived from ~pyrseas.dbobject.DbType and represents a Postgres range type.

autoclass: Range

automethod: Range.to_map

automethod: Range.create

automethod: Range.alter

Type Dictionary

TypeDict is derived from ~pyrseas.dbobject.DbObjectDict. It is a dictionary that represents the collection of domains and enums in a database.

autoclass: TypeDict

automethod: TypeDict.from_map