set_link

Aliases: addfk (deprecated).

set_link [^label]?, [keyfield: col storable]+

Add a foreign key to the output, which identifies the target dataset and columns used to find a target resource.

Categories

Accelerable

set_link 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_link "Related Resource", src1:@target.dst1, src2:@target.dst2

Adds a foreign key that links to @target, matching dst1 and dst2 in the target to src1 and src2 in the current dataset. The key label is set to "Related Resource".

set_link src1:@foo.dst1

Adds a foreign key that links to @foo, matching dst1 in the target to src1 in the current dataset. The key label is set from the existing label of the target @foo.

set_link "Account Name", src1:@target.dst1, src2:@target.dst2

Adds a foreign key that links to @target, matching dst1 in the target to src1 in the current dataset and matching dst2 in the target to src2 in the current dataset. The key label is set from the existing label of the target @target. So if the target dataset's label is "Account", the "Account" column will be used to fill the "Account Name" label for the source dataset.

If the target dataset doesn't have a label, the first primary key of the target dataset will be selected to fill in the "Account Name" label regardless of how you set the order of the dst matches for the set_link verb. If the target dataset has dst1 as the first primary key, dst1 will be used to fill in the "Account Name" label.