Indexes

The index module defines two classes, Index and IndexDict, derived from DbSchemaObject and DbObjectDict, respectively.

Index

Class Index is derived from DbSchemaObject and represents an index on a database table, other than a primary key or unique constraint index. Its keylist attributes are the schema name, the table name and the index name.

An Index has the following attributes: access_method, unique, and keycols.

class pyrseas.dbobject.index.Index(name, schema='public', description=None, **attrs)

A physical index definition, other than a primary key or unique constraint index.

Index.key_expressions()

Return comma-separated list of key column names and qualifiers

Returns:string
Index.to_map(db)

Convert an index definition to a YAML-suitable format

Returns:dictionary
Index.create(obj, *args, **kwargs)

Return a SQL statement to CREATE the index

Returns:SQL statements

Index Dictionary

Class IndexDict is derived from DbObjectDict and represents the collection of indexes in a database.

class pyrseas.dbobject.index.IndexDict(dbconn=None)

The collection of indexes on tables in a database

IndexDict.from_map(table, inindexes)

Initialize the dictionary of indexes by converting the input map

Parameters:
  • table – table owning the indexes
  • inindexes – YAML map defining the indexes