set_primary_key
Aliases: set_pk, setpk (deprecated).
set_primary_key [columnname: col storable]+
Declare the primary key of the output as consisting of one or more named columns.
All rows with the same value in this column (or these columns) will be considered part of the same resource. This is a low-level function that will generate confusing results if not used as part of a larger context. It is recommended to instead use 'make_resource' or 'update_resource' or 'timechart' to go from event to resource, and 'make_event' to go from resource to event shape.
Note that time columns can be used as part of a primary key, and this can be a useful trick to produce resources that contain only one interval each.
Categories
Accelerable
set_primary_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
set_primary_key device_uid
Sets the primary key designation of the output dataset as the 'device_uid' field.
Updated 8 days ago