Skip to content

profile_metadata_to_records

Public callable

Convert Spark metadata profile rows into JSON-friendly dictionaries.

Source code in src/fabricops_kit/profiling.py
224
225
226
227
228
229
230
231
def profile_metadata_to_records(profile_df) -> list[dict[str, Any]]:
    """Convert Spark metadata profile rows into JSON-friendly dictionaries."""
    records = []
    for row in profile_df.collect():
        item = row.asDict() if hasattr(row, "asDict") else dict(row)
        normalized = {k: (v.isoformat() if hasattr(v, "isoformat") else v) for k, v in item.items()}
        records.append(normalized)
    return records