schema-refactor
See docs/reference/README.md for the MUST/SHOULD/MAY convention, and
docs/reference/shared.md for rules schema-refactor shares with other tools.
Inputs¶
schema-refactorMUST read the input and reproject it to EPSG:4326 the same way every other tool does, viacore.io.read_and_reproject().schema-refactorMUST take a crosswalk CSV file (as written byschema-map, or a hand-edited copy of one): one row per source column withsource_columnandtarget_columncolumns.schema-refactorMUST raiseValueErrorif the crosswalk'ssource_columnset does not exactly equal the input file's own column set, excluding any column matchingcore.constants.is_noise_column()(extra columns in either direction), catching a stale crosswalk or a mismatched input file rather than silently mis-mapping or dropping data.schema-refactorMUST raiseValueErrorif two source columns share the same non-nulltarget_column, or if atarget_columncollides with a reserved name (fid,geom,geometry), rather than letting DuckDB silently disambiguate the output column names.schema-refactorMUST raiseValueErrorif the crosswalk file is not a CSV with asource_columncolumn.- A row with a blank
source_column(aschema-map-written gap-row placeholder) MUST be skipped, not raise. schema-refactorMUST raiseValueErrorif the crosswalk lists the samesource_columnmore than once.
Renaming¶
- A source column whose
target_columnis null or empty MUST be dropped from the output. - Every other source column MUST be renamed to its
target_column. - The geometry column MUST always pass through unchanged, regardless of the crosswalk.
Outputs¶
schema-refactorperforms no topology hard gate at all; it only renames/drops columns, never touching geometry.
Configuration (api.schema_refactor.refactor() / CLI)¶
schema-refactorMUST process exactly one input file per call.- The output path MUST default to the input path with a
_mappedsuffix. schema-refactorMUST raiseFileExistsErrorif the output path already exists and overwriting wasn't requested.step, if given, MUST be one ofinputs,rename,outputs; any other value MUST raiseValueError.