Skip to main content

SQL

Apply a SQL command to the current dataframe. Only SELECT statements are supported - the result will be the output.

Apply a SQL command to the current dataframe. Only SELECT statements are supported; the result becomes the output. The current table is called df.

info

SQL does not currently work with objects. If your table contains objects, use convert.to_json before using SQL. SQL is not compatible with where filtering.

Parameters​

NameDescriptionAccepted ValuesDefaultRequired
Options
commandSQL Command. The table is called df. For specific SQL syntax, this uses the SQLite dialect.string—Yes
paramsVariables to use in conjunctions with query. This allows the query to be parameterized. This uses sqlite syntax (? or :name).array, object, nullnullNo
preserve_data_typesPreserve Data Types value accepted by the runtime.booleantrueNo
Formatting
preserve_indexPreserve Index value accepted by the runtime.booleanfalseNo
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

Examples​

wrangles:
- sql:
command: |
SELECT header1, header2
FROM df
WHERE header1 >= 2
header1header2header3
1ax
2by
3cz
header1header2
2b
3c
Access
RequirementValue
AI-poweredNo
Requires WrangleWorks accountNo
Requires subscriptionNo
Requires external API keyNo
Technical details
FieldValue
Catalog ID94
Catalog keysql
Recipe keysql
Catalog statusactive
Lifecycle statusactive
Recipe Writer eligibleYes
NamespaceRoot-level
Documentation groupcompute
AliasesNone
Runtime symbolwrangles.recipe_wrangles.main.sql
Legacy UUID467a06b1-a697-4d31-8061-7d83a719fd79

Sources