pyaccesskit.schema.indexes¶
pyaccesskit.schema.indexes ¶
Index specifications.
PRIMARY_KEY_NAME
module-attribute
¶
PRIMARY_KEY_NAME = 'PrimaryKey'
The name Access gives primary-key indexes.
IndexField ¶
Bases: SpecModel
One column of an index, optionally in descending order.
IndexSpec ¶
Bases: SpecModel
An index on one or more columns.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Index name (Access names the primary key |
fields |
Items[IndexField]
|
Indexed columns; plain strings are accepted ( |
primary |
bool
|
This is the table's primary key (implies |
unique |
bool
|
No two rows may have the same key. |
required |
bool
|
Null values are not allowed in the indexed columns. |
ignore_nulls |
bool
|
Rows with Null keys are left out of the index. |
primary_key
classmethod
¶
primary_key(
*columns: str, name: str = PRIMARY_KEY_NAME
) -> IndexSpec
A primary-key index on columns (named PrimaryKey like Access does).
on
classmethod
¶
on(
name: str,
*columns: str | tuple[str, str],
unique: bool = False,
**options: bool,
) -> IndexSpec
Convenience constructor: IndexSpec.on("ix_Name", "LastName", "FirstName", unique=True).