zut.db.ForeignKey

class zut.db.ForeignKey(related_table: 'str | tuple | type | DbObj', columns: 'Mapping[str, str | ForeignKey] | Sequence[str] | str', *, basename: 'str | None' = None, db: 'Db | type[Db] | None' = None)

Bases: object

__init__(related_table: str | tuple | type | DbObj, columns: Mapping[str, str | ForeignKey] | Sequence[str] | str, *, basename: str | None = None, db: Db | type[Db] | None = None)

Methods

__init__(related_table, columns, *[, ...])

Attributes

basename

Base name of the foreign Key.

suffixes

related_table

Related table of the forein key.

columns

Association of the source columns (e.g. 'basename_id1' and 'basename_id2') to the matching primary key in the related table.

property basename: str | None

Base name of the foreign Key. This is normally the name of the field(s) without the _id or _pk suffix.

columns: Mapping[str, str | ForeignKey]

Association of the source columns (e.g. ‘basename_id1’ and ‘basename_id2’) to the matching primary key in the related table.

related_table: DbObj

Related table of the forein key.