def test_get_table_name(root_table: str, base_table_name: str, suffix: str,
                        expected: str):
    name_transformer = DestinationNameTransformer(DestinationType.POSTGRES)
    name = get_table_name(name_transformer, root_table, base_table_name,
                          suffix, ["json", "path"])
    assert name == expected
    assert len(
        name
    ) <= 43  # explicitly check for our max postgres length in case tests are changed in the future
Example #2
0
def test_get_table_name(root_table: str, base_table_name: str, suffix: str,
                        expected: str):
    """
    - parent table: referred to as root table
    - child table: referred to as base table.
    - extra suffix: normalization steps used as suffix to decompose pipeline into multi steps.
    - json path: in terms of parent and nested field names in order to reach the table currently being built

    See documentation of get_table_name method for more details.

    But this test check the strategies of combining all those fields into a single table name for the user to (somehow) identify and
    recognize what data is available in there.
    A set of complicated rules are done in order to choose what parts to truncate or what to leave and handle
    name collisions.
    """
    name_transformer = DestinationNameTransformer(DestinationType.POSTGRES)
    name = get_table_name(name_transformer, root_table, base_table_name,
                          suffix, ["json", "path"])
    assert name == expected
    assert len(
        name
    ) <= 43  # explicitly check for our max postgres length in case tests are changed in the future