table_name2id

View page source

Map a Table Row Name to The Row Index

Prototype

# at_cascade.table_name2id
def table_name2id(
    table, tbl_name, row_name
) :
    assert type(table) == list
    assert type(tbl_name) == str
    # ...
    assert type(row_id) == int
    return row_id

table

This is a list of dict containing the table. The primary key is not included because it is the row index.

tbl_name

This is a str containing the name of the table. This table must have a column named table_name_name.

row_name

This is the value we are searching for in the table_name_name column.

row_id

This is the index of the row in the table where row_name occurs. An assert will occur if there is no such row.