Skip to main content

references()

A foreign key: every non-NULL value of col occurs in the column to

Usage

Source

references(
    col,
    *,
    to=None,
)

of another table.

Only for requires, where it is checked on the data like unique (the referenced table must be bound to the same backend). With a key on the referenced column it lets Rel.optimize turn a left join on it into an inner join (Report.optimized). Not supported by incremental views.

Parameters

col: str

The referencing column of the input the condition is on.

to: ir.Column | tuple[str, str] | None = None
The referenced column, keyword-only: an Ibis column of a named table (customers.id), or a (table, column) pair of names as verify and the backend know them.

Returns

References
A References condition, for requires.

Raises

TypeError
to is missing, or is not a column of a named table.

Examples

sv.references("customer_id", to=customers.id)
sv.references("customer_id", to=("customers", "id"))