parq_blockmodel.schema.utils

parq_blockmodel.schema.utils#

Pure utility functions for schema handling and validation.

Functions in this module are stateless and can be used independently of any ParquetBlockModel or SchemaService instance.

Functions

build_parquet_compression_kwargs

Build Parquet writer kwargs from a resolved compression policy.

build_schema_metadata

Build combined metadata dict for Parquet schema (geometry + schema YAML + compression).

df_eval_operations_from_schema

Extract df-eval operations from a pandera schema.

dump_schema_yaml

Serialize a pandera schema to YAML text.

extract_column_aliases_from_schema

Extract alias mappings from schema df-eval metadata.

extract_required_columns_from_schema

Extract the set of column names that are required (should be persisted).

extract_schema_compression_policy

Read compression policy from schema metadata if present.

load_embedded_compression

Extract compression policy metadata embedded in a Parquet file.

load_embedded_schema

Extract and load a schema embedded in Parquet metadata.

load_schema

Load and return a pandera DataFrameSchema.

resolve_active_compression_policy

Resolve a simple user-facing compression choice for active writes.

resolve_archive_compression_policy

Resolve archive compression using schema metadata or explicit policy.

schema_uses_strict_filter

Return True when schema root-level strict mode is set to "filter".

select_df_eval_operations

Recursively select df-eval operations and their dependencies.

validate_chunk

Validate and coerce a single DataFrame chunk against a schema.