Skip to content

mapping_docs

SQLGlot to CLOE Metadata Mapping Documentation.

This module documents the mapping between SQLGlot parsed objects and CLOE metadata models.

get_mapped_attributes()

Get all successfully mapped attributes.

Source code in src/cloe_delta_table_manager/sql_parser/mapping_docs.py
def get_mapped_attributes() -> dict[str, Any]:
    """Get all successfully mapped attributes."""
    mapped: dict[str, Any] = {}

    for category, mappings in SQLGLOT_TO_CLOE_MAPPING.items():
        if isinstance(mappings, dict) and "mapped" in mappings:
            mapped[category] = mappings["mapped"]

    return mapped

get_mapping_documentation()

Get the complete mapping documentation.

Source code in src/cloe_delta_table_manager/sql_parser/mapping_docs.py
def get_mapping_documentation() -> dict[str, Any]:
    """Get the complete mapping documentation."""
    return SQLGLOT_TO_CLOE_MAPPING

get_undefined_mappings()

Get all undefined/unmapped attributes.

Source code in src/cloe_delta_table_manager/sql_parser/mapping_docs.py
def get_undefined_mappings() -> dict[str, Any]:
    """Get all undefined/unmapped attributes."""
    undefined: dict[str, Any] = {}

    for category, mappings in SQLGLOT_TO_CLOE_MAPPING.items():
        if isinstance(mappings, dict) and "undefined" in mappings:
            undefined[category] = mappings["undefined"]

    return undefined

print_mapping_summary()

Generate a human-readable mapping summary.

Source code in src/cloe_delta_table_manager/sql_parser/mapping_docs.py
def print_mapping_summary() -> str:
    """Generate a human-readable mapping summary."""
    lines = _format_header()
    lines.extend(_format_object_mappings(SQLGLOT_TO_CLOE_MAPPING["object_mappings"]))

    for category in ["table", "column", "schema", "database"]:
        key = f"{category}_parameter_mappings"
        if key in SQLGLOT_TO_CLOE_MAPPING:
            lines.extend(_format_parameter_section(category, SQLGLOT_TO_CLOE_MAPPING[key]))

    return "\n".join(lines)