name: import-schema-rows
description: Importing a tabular source — an explicit schema matched by column name and its refusal codes, what inference decides (float width, nullability, widths, blank cells), zero-row and partial row failures, format dispatch, compressed and .pulse sources, and the one JSON casing. Topical design; the managed-import tool's own arguments in its atomic skill.
type: guide
kind: design
applies_to: process, compose, predict
covers: [import, --schema, explicit schema, ignore_extra, --float, row errors, PULSE_IMPORT_ROWS_DROPPED, PULSE_IMPORT_ROW_ERROR, PULSE_IMPORT_FORMAT_UNKNOWN, PULSE_COHORT_COMPRESSED, passthrough]
Import: explicit schema, inference, row failures
The same rules hold for every import path: CLI pulse import <fmt> / import auto / import predict / convert, the library ImportJob / ConvertJob / ImportSpec, and pulse_import. Types and widths: cohort-schema-design; SPSS: spss-import-schema; zones: import-source-zones; vector fields: vector-fields; parent groups: cohort-parent-groups.
An explicit schema matches BY NAME
[{name, type, nullable, description}] (precision / scale for decimal128; dim REQUIRED plus labels / kind / scale_min / scale_max for vec_*) — the --schema document, the Schema field, the MCP schema argument. Omit it to infer.
- Fields match source columns by exact spelling, in any order, never by position; the array’s order is the cohort’s.
- Refused before any row is read: a field with no column
PULSE_IMPORT_SCHEMA_FIELD_MISSING; a column no field namesPULSE_IMPORT_SCHEMA_COLUMN_UNMAPPED; a repeated namePULSE_IMPORT_SCHEMA_DUPLICATE; an NDJSON / JSON-array key first seen after the first object (whose keys are the columns)PULSE_IMPORT_SCHEMA_KEY_LATE; an unknown type namePULSE_IMPORT_SCHEMA_TYPE_UNKNOWN(never read as f64); an unknown entry key, an empty array or a schema on a.pulsesourcePULSE_IMPORT_SCHEMA_INVALID. ignore_extra(--ignore-extra) drops unnamed columns and late keys instead of refusing.- So a narrowed output (a projected
--stream) is never re-imported with its columns silently shifted. - Not kept on the managed sidecar: the cohort header records the schema.
- Declared nullability and widths are contracts: a null in a non-nullable field, or an overflow, is a per-row
PULSE_IMPORT_ROW_ERROR.
What inference decides
- Floats infer
f64— decimals stay exact, money sums never drift.float: "f32"(--float f32) halves the bytes for the whole import, rounding to ~7 digits; any other value isPULSE_IMPORT_FLOAT_WIDTH_INVALID. - Nullability comes from the first sampled rows; a later null promotes the field (
promoted_fields+ onenull_warningsentry,PULSE_IMPORT_NULL_PROMOTED;cohort-null-states). - Widths: a value past the sampled width promotes the field to the narrowest type holding it — never a dropped row — with one
width_warningsentry (PULSE_IMPORT_WIDTH_PROMOTED:field,from,to,source_row;cohort-width-overflow). - A blank categorical cell:
csv/tsv/excelread it as NULL (one spelling for both — a documented gap that always collapses toward null);ndjson/jsonarray/arrow/parquetcarry their own null channel, so""is an empty-string VALUE and onlynullis null. A blank numeric or date cell is null everywhere. - SPSS is schema-authoritative: inference and the sampling knobs are skipped,
promoted_fieldsstays empty. - Arrow / Parquet pin each column whose type declares a width — unsigned int, float32/64, bool, date, timestamp,
decimal128(precision/scale) — to that type: never promoted, an overflow is a row error. Signed ints, strings, dictionaries and lists infer; nullability is inferred;column_type_overridesbeats a pin. - A field description over 1000 bytes is
PULSE_IMPORT_DESCRIPTION_TOO_LONG; an empty, sub-10-byte or generic one (e.g. “n/a”, “tbd”, “column”) warnsPULSE_FIELD_DESCRIPTION_LOW_QUALITY(an error under--strict).
Row failures
- Zero rows out of a non-empty source is FATAL
PULSE_IMPORT_ROW_ERROR, not an empty import: detailsrows_read,rows_failed,first_row,first_error; no cohort is written. Export and convert mirror it withPULSE_EXPORT_ROW_ERROR(convert’s uncoded row errors come from the TARGET writer), and convert writes no--keep-pulseintermediate. - A PARTIAL failure imports the good rows and warns
PULSE_IMPORT_ROWS_DROPPED(detailsdropped,imported,first_failure {row, column, reason}, plusstagesource/target/keep_pulseon convert) — fatal under CLI--strict(exit 1) orOptions.Strict, writing nothing. - A source with no data rows is a legitimate empty cohort.
Dispatch and sources
- One dispatch: detection and reader construction go through the
iofactory (io.FormatFromPath→io.NewReader), the same one the CLI and embedders use. No extension match and noformat→PULSE_IMPORT_FORMAT_UNKNOWN; an explicitformatoutside the list →PULSE_IO_FORMAT_UNSUPPORTED. - A
.pulse.zst(zstd transfer artifact) is refusedPULSE_COHORT_COMPRESSED, even renamed.pulse; decompressing ispulse import transfer(CLI only;cohort-sharding). - A
.pulsesource passes through: no copy, no sidecar (managed: false). - A window, feature or attribute column is not an import job: materialize it (
derived-cohorts) — exact and atomic; never re-import a streamed result. - One casing: every CLI
import <fmt>/import predict/convert/export/shard--jsondatauses snake_case keys (rows_imported,schema.fields[].typeas a name like"f64").