pasteur.table.ReferenceManager#

class pasteur.table.ReferenceManager(meta, name)[source]#

Manages the foreign relationships of a table.

Methods

find_foreign_ids(name, get_table)

Creates an id lookup table for the provided table.

find_parents(table)

Finds the reference cols that link a table to its parents and returns tuples with the name of that column, the name of the parent table and the name of the parent key column (usually the primary key).

get_foreign_keys(name, table)

Returns the id columns of a table with a foreign reference.

get_id_cols(name[, ref])

Returns the id column names of the provided table.

get_table_data(name, table)

Returns the data columns of a table.

table_has_reference()

Checks whether the table has a column that depends on another table's column for transformation.

find_foreign_ids(name, get_table)[source]#

Creates an id lookup table for the provided table.

The id lookup table is composed of columns that have the foreign table name and contain its index key to join on.

find_parents(table)[source]#

Finds the reference cols that link a table to its parents and returns tuples with the name of that column, the name of the parent table and the name of the parent key column (usually the primary key).

Return type:

list[tuple[str, str, str]]

get_foreign_keys(name, table)[source]#

Returns the id columns of a table with a foreign reference.

get_id_cols(name, ref=False)[source]#

Returns the id column names of the provided table. If ref is set to True, only the ids with a reference are returned.

get_table_data(name, table)[source]#

Returns the data columns of a table.

table_has_reference()[source]#

Checks whether the table has a column that depends on another table’s column for transformation.