Skip to content

pyaccesskit.schema.tables

pyaccesskit.schema.tables

Table specifications.

MAX_INDEXES module-attribute

MAX_INDEXES = 32

Access limit per table, including the hidden indexes created for enforced relationships.

TableSpec

Bases: SpecModel

A local Access table.

Indexes can be declared explicitly in indexes or with shorthands: primary_key= here, or primary_key=/unique=/indexed= on individual columns. :meth:normalized expands every shorthand into explicit :class:IndexSpec objects; that canonical form is what introspection returns.

Attributes:

Name Type Description
name str

Table name.

columns Items[ColumnSpec]

Columns in order (1-255).

indexes Items[IndexSpec]

Explicit indexes.

primary_key Items[str] | None

Shorthand for a (possibly composite) primary key.

description str | None

Table Description property.

validation_rule str | None

Table-level Validation Rule (can reference several columns).

validation_text str | None

Message shown when the table validation rule fails.

properties dict[str, PropertyValue]

Other Access/DAO table properties to set verbatim (escape hatch).

column_names property

column_names: tuple[str, ...]

Column names in order.

primary_index property

primary_index: IndexSpec | None

The primary-key index, if any (shorthands included).

column

column(name: str) -> ColumnBase

Return the column called name (case-insensitive).

Raises:

Type Description
KeyError

If there is no such column.

effective_indexes

effective_indexes() -> tuple[IndexSpec, ...]

All indexes with shorthands expanded, primary key first, then by name.

normalized

normalized() -> TableSpec

The canonical form: shorthands expanded into indexes and cleared from columns.