Sid-WC121
initial
c21180c
Raw History Blame Contribute Delete
799 Bytes
"""Validation helpers for operation parameters."""
from __future__ import annotations
from typing import Any
def validate_column_exists(column: str, schema: list[dict[str, Any]]) -> bool:
"""Check that a column exists in the schema."""
return any(c["name"] == column for c in schema)
def validate_columns_exist(columns: list[str], schema: list[dict[str, Any]]) -> list[str]:
"""Return list of columns that don't exist."""
existing = {c["name"] for c in schema}
return [c for c in columns if c not in existing]
def validate_numeric_column(column: str, schema: list[dict[str, Any]]) -> bool:
"""Check that a column is numeric."""
for c in schema:
if c["name"] == column:
return c.get("column_type") in ("numeric", "geo_lat_lon")
return False