Skip to main content

Lookup Wrangles

Lookup wrangles, with recipe examples, parameters, and behavior.

Lookup​

Lookup values from a saved lookup wrangle.

Look up data from a saved Lookup Wrangle. Data is output as a dictionary if an output is not specified or the output does not match any columns in the lookup. If specific lookup columns are named in the output, they will be output as individual columns.

Parameters​

NameDescriptionAccepted ValuesDefaultRequired
I/O
inputName of the column(s) to lookup.string—Yes
outputName of the output column(s). When n is provided and the output list length equals n, each output column receives the corresponding match. A single output containing a wildcard (*) is expanded into n columns, e.g. "Top *" with n: 3 becomes "Top 1", "Top 2", "Top 3".string, array, nullnullNo
Options
lookup_modeHow to perform lookups. 'by_row' (default): lookup each row individually. 'by_dataframe': lookup unique values once, copy results to all rows. 'by_matrix': lookup once per matrix permutation.string; one of:
  • by_row
  • by_matrix
  • by_dataframe
"by_row"No
nNumber of matches to return per input value. When the output list length equals n, each output column receives the corresponding match. Otherwise all n matches are stored as a list in each output column.integer, nullnullNo
Conditions
ifCondition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}.string—No
whereFilter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'.string—No
where_paramsValues used with where for parameterized criteria. Uses SQLite placeholder syntax such as ? or :name.array, object—No
Details
model_idThe model_id to use lookup against.string, nullnullNo

Examples​

wrangles:
- lookup:
input: State
output:
- Abbreviation
model_id: 55555555-5555-5555
State
Texas
New York
Virginia
Abbreviation
TX
NY
VA
Access
RequirementValue
AI-poweredNo
Requires WrangleWorks accountNo
Requires subscriptionNo
Requires external API keyNo
Technical details
FieldValue
Catalog ID81
Catalog keylookup
Recipe keylookup
Catalog statusactive
Lifecycle statusactive
Recipe Writer eligibleYes
NamespaceRoot-level
Documentation grouplookup
AliasesNone
Runtime symbolwrangles.recipe_wrangles.main.lookup
Legacy UUIDb3339193-d1cc-4c89-8ed6-901efa6d81be

Sources