pyaccesskit.relationships¶
pyaccesskit.relationships ¶
Relationships: the db.relationships collection.
Relationship ¶
Relationship(session: Session, name: str)
RelationshipCollection ¶
RelationshipCollection(session: Session)
db.relationships.
create ¶
create(spec: RelationshipSpec) -> Relationship
create(
primary: ColumnRef,
foreign: ColumnRef,
/,
*,
name: str | None = None,
enforce_integrity: bool = True,
cascade_update: bool = False,
cascade_delete: bool = False,
one_to_one: bool = False,
join: JoinType = JoinType.INNER,
) -> Relationship
create(
primary: RelationshipSpec | ColumnRef,
foreign: ColumnRef | None = None,
/,
*,
name: str | None = None,
enforce_integrity: bool = True,
cascade_update: bool = False,
cascade_delete: bool = False,
one_to_one: bool = False,
join: JoinType = JoinType.INNER,
) -> Relationship
Create a relationship from the primary ("one") side to the foreign ("many") side.
Example::
db.relationships.create("Customers.CustomerID", "Orders.CustomerID", cascade_delete=True)
The primary columns need a primary key or unique index. The default name follows Access's convention (primary table + foreign table).