Database Objects

module: pyrseas.dbobject

The dbobject module defines two low-level classes and an intermediate class. Most Pyrseas classes are derived from either DbObject or DbObjectDict.

Database Object

A DbObject represents a database object such as a schema, table, or column, defined in a PostgreSQL system catalog. It is initialized from a dictionary of attributes. Derived classes should define a keylist that is a list of attribute names that uniquely identify each object instance within the database.

autoclass: DbObject

autoattribute: DbObject.objtype

automethod: DbObject.extern_key

autoattribute: DbObject.keylist

automethod: DbObject.key

automethod: DbObject.identifier

automethod: DbObject.to_map

automethod: DbObject.comment

automethod: DbObject.drop

automethod: DbObject.rename

automethod: DbObject.diff_description

Database Object Dictionary

A DbObjectDict represents a collection of DbObject's and is derived from the Python built-in type dict. If a ~pyrseas.dbconn.DbConnection object is used for initialization, an internal method is called to initialize the dictionary from the database catalogs. The DbObjectDict fetch method fetches all objects using the query defined by derived classes. Derived classes should also define a cls attribute for the associated DbObject class, e.g., ~pyrseas.schema.SchemaDict sets cls to ~pyrseas.schema.Schema.

autoclass: DbObjectDict

autoattribute: DbObjectDict.cls

autoattribute: DbObjectDict.query

automethod: DbObjectDict.fetch

Schema Object

A DbSchemaObject is derived from DbObject. It is used as a base class for objects owned by a schema and to define certain common methods. This is different from the ~pyrseas.schema.Schema that represents the schema itself.

autoclass: DbSchemaObject

automethod: DbSchemaObject.identifier

automethod: DbSchemaObject.qualname

automethod: DbSchemaObject.unqualify

automethod: DbSchemaObject.drop

automethod: DbSchemaObject.rename

automethod: DbSchemaObject.set_search_path