Skip to main content

Add Field

Add a field to a table.

For most tables, Magpie trusts the new field's definition without checking the underlying data. The exception is a table whose persistence mapping is a SQL query (create table ... from sql(...)), or a generic Spark source that determines its own schema (usesSchema: false). For those two mapping types, Magpie validates the query or connector's actual output schema against the table's declared schema on every read — so if the new field isn't actually produced by the underlying query or connector, the next read fails with a missing-field error. See Drop Field for the equivalent caveat on removing a field.

Syntax​

alter table <table reference> add field <field spec>

Parameters​

table reference​

String — Name of the table to add a field to, optionally qualified by schema.

field spec​

JSON — Definition of the new field.