add_key

Aliases: addkey (deprecated).

add_key [keyfield: col storable]+

Declares an extra candidate key: the listed columns together are treated as identifying a resource instance for metadata and linking.

Each argument must be a single top-level column from the primary input—no dataset prefix and no path into a nested field. The same column cannot appear twice in one add_key. If that key is already the primary key or matches an existing candidate key, metadata stays the same. The output row shape matches the input; only key metadata changes. See make_resource for defining a primary key and interface for how interfaces interact with keys.

Categories

Accelerable

add_key is always accelerable if the input is accelerable. A dataset that only uses accelerable verbs can be accelerated, making queries on the dataset respond faster.

Examples

add_key month_number

Registers month_number as a candidate key on the shared months table so metadata treats that column as identifying rows for linking, without changing visible columns.