asyncqlio.orm.schema.index

Represents

Classes

Index(*columns[, unique, table]) Represents an index in a table in a database.
class asyncqlio.orm.schema.index.Index(*columns, unique=False, table=None)[source]

Bases: object

Represents an index in a table in a database.

class MyTable(Table):
    id = Column(Integer, primary_key=True)
    name = Column(Text)

    # make an index on the name column
    # by specifying it as the column
    name_index = Index(name)

New in version 0.2.0.

Parameters:
  • columns (Union[Column, str]) – The Column objects that this index is on.
  • unique (bool) – Is this index unique?
  • table (Optional[Table]) – The Table for this index. Can be None if the index is a member of a table.
get_column_names()[source]
Return type:Generator[str, None, None]
Returns:A generator that yields the names of the columns for this index.
table_name

The name of this index’s table.

Return type:str
quoted_name

Gets the quoted name for this Index.

This returns the column name in “index” format.

quoted_fullname

Gets the full quoted name for this index.

This returns the column name in “table”.”index” format.

classmethod with_name(name, *args, **kwargs)[source]

Creates this column with a name and, optionally, table name already set.

Return type:Index
get_ddl_sql()[source]

Gets the DDL SQL for this index.

Return type:str
generate_schema(fp)[source]

Generates the library schema for this index.

Return type:str