Skip to content

Write Reference Table

Bulk-loads parsed rows into a Data Lake reference table.

@lainstack/reference-table/write · Data

Write Reference Table loads a Table into an existing Reference Table, matching rows by the table’s primary key. It changes stored Reference Table data. A test run does not make it side-effect free, so confirm with the user before test-running a draft that contains it.

Typical pattern: @lainstack/csv/parse produces a Table handle, and this block writes it. The parsed input also accepts an inline Table value. Use @lainstack/reference-table/read or @lainstack/reference-table/find-required-record to read data back.

Traps:

  • The target must be an upsert_pk table with a primary-key column. Other tables fail the step.
  • target pins the table schema and primary key as configured. If the live table changed since, the step fails with status 409. Refresh the target and reconfigure.
  • Source columns map to target columns by column id, then by provenance, then by normalized column name. An unmatched, ambiguous or incompatible column fails the step with a mapping error. A nullable source column cannot fill a required target column.
  • Every row needs a non-null primary-key value, and values must be unique inside the source. A duplicate fails the step and publishes nothing.
  • The source holds at most 1,000 rows. An empty source succeeds with summary.rowsWritten of 0 and changes nothing.
  • The write is staged, then published as one revision, or not at all. A replay of the same block in the same run does not publish twice.
Setting Key Type Details
Reference Table (required) referenceTableId Text Choose the Reference Table to update.
Table (required) parsed Value Build rows or use a Table from an earlier step.
Output Path Type
Rows read summary.rowsRead Number
Rows written summary.rowsWritten Number