_catalog#

Contains classes for specifying schemas and constraints for tables.

Classes#

Table

Metadata for a public or private table.

PublicTable

Metadata for a public table.

PrivateTable

Metadata for a private table.

Catalog

Specifies schemas and constraints on public and private tables.

class Table#

Bases: abc.ABC

Metadata for a public or private table.

source_id :str#

The source id, or unique identifier, for the table.

schema :tmlt.analytics._schema.Schema#

The analytics schema for the table. Describes the column types.

id_space :Optional[str]#

The identifier space for the table.

class PublicTable#

Bases: Table

Metadata for a public table.

Public tables contain information that is generally not sensitive and does not require any special privacy protections.

source_id :str#

The source id, or unique identifier, for the table.

schema :tmlt.analytics._schema.Schema#

The analytics schema for the table. Describes the column types.

id_space :Optional[str]#

The identifier space for the table.

class PrivateTable#

Bases: Table

Metadata for a private table.

Private tables contain sensitive information, such as PII, whose privacy has to be protected.

source_id :str#

The source id, or unique identifier, for the table.

schema :tmlt.analytics._schema.Schema#

The analytics schema for the table. Describes the column types.

id_space :Optional[str]#

The identifier space for the table.

class Catalog#

Specifies schemas and constraints on public and private tables.

__init__()#

Constructor.

add_private_table(source_id, col_types, grouping_column=None, id_column=None, id_space=None)#

Adds a private table to catalog. There may only be a single private table.

Parameters
  • source_id (str) – The source id, or unique identifier, for the private table.

  • col_types (Mapping[str, Union[tmlt.analytics._schema.ColumnDescriptor, tmlt.analytics._schema.ColumnType]]) – Mapping from column names to types for private table.

  • grouping_column (Optional[str]) – Name of the column (if any) that must be grouped by in any groupby aggregations that use this table.

  • id_column (Optional[str]) – Name of the ID column for this table (if any).

  • id_space (Optional[str]) – Name of the identifier space for this table (if any).

Raises

ValueError – If there is already a private table.

add_public_table(source_id, col_types)#

Adds public table to catalog.

Parameters
Raises

ValueError – If there is already a private table.

property tables#

Returns the catalog as a dictionary of tables.

Return type

Dict[str, Table]