loom.core.model.scoped

Marker and descriptors for tables whose rows are scoped by a column value.

Functions

registered_model_tables(registered, scoped)

The registered tables that stand for a model table.

Classes

RowScoped()

Mark a model as row-scoped; adds no column.

ScopeColumn(scope, column, on, elevable)

One scoped column: which scope, which column, and how far it reaches.

ScopedTable(schema, name, scopes, privileges)

A compiled scoped table: its scopes, the privileges it grants and its partition column.

class loom.core.model.scoped.RowScoped[source]

Bases: object

Mark a model as row-scoped; adds no column.

The product names the scope on one of the model’s columns with ColumnField(scope=...). A read-only scoped table narrows __scope_privileges__ to {Privilege.SELECT}.

class loom.core.model.scoped.ScopeColumn(scope, column, on, elevable)[source]

Bases: object

One scoped column: which scope, which column, and how far it reaches.

Parameters:
class loom.core.model.scoped.ScopedTable(schema, name, scopes, privileges, partition_by=None)[source]

Bases: object

A compiled scoped table: its scopes, the privileges it grants and its partition column.

partition_by names the column a range-partitioned table is partitioned by, None for a plain table.

Parameters:
loom.core.model.scoped.registered_model_tables(registered, scoped)[source]

The registered tables that stand for a model table.

registered maps each table the guard registered to the table it is a partition of, or None. A partition of a partitioned scoped table is not in the model and stands for its parent, so it is left out; every other registered table is kept.

Parameters:
Return type:

frozenset[str]