Map Version To Schema
POST/datasets/:dataset_id/versions/:version_id/map
Apply column mapping and advance stage to mapped.
Reads the version's Parquet (using original_minio_path when available
so re-mapping always starts from the original file), applies the column
rename specified by body.column_mapping (GDI field → dataset column),
and writes the result to a new object, repointing minio_path at it.
The write never lands back on an object minio_path/original_minio_path
currently name — not the upload, not a version's own former golden snapshot
if it was demoted, and not an object shared by pointer copy with a different
version's row (dimension-draft minting sets a new version's minio_path to
an existing version's current path with no object write). Enumerating which
existing objects are safe to overwrite in place has twice missed a case that
corrupted a golden dataset, so nothing is overwritten in place at all.
Stores the mapping in dataset_metadata["column_mapping"] and sets
stage="mapped".
Calling this endpoint a second time with the mapping the version already
records is accepted, so retries are safe. A different second mapping
re-derives from the original file for versions carrying
original_minio_path — that object is never touched, so it is always
available to re-derive from. Augmented, trace-landed and ground-truth
versions have no upload artifact to re-derive from, so a changed mapping
there resolves against whatever the previous mapping produced and is
rejected when that no longer has the columns requested.
Rejects with 422 when a mapping value names a column that is not there,
which is what an inverted {dataset column → GDI field} mapping looks
like; the error lists the columns actually available. Also rejects a
mapping that points two GDI fields at one source column, which would
otherwise drop one of the two renames. Also rejects with 422 when the
version's upload was already overwritten by a historical mapping bug — its
original columns cannot be recovered, and re-mapping is refused rather
than silently building on the corrupted data; upload a fresh version
instead.
Request
Responses
- 200
- 401
- 403
- 404
- 422
Successful Response
Unauthorized
Forbidden
Not Found
Unprocessable Entity