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
| Name | Description | Accepted Values | Default | Required |
|---|---|---|---|---|
| Options | ||||
command | SQL Command. The table is called df. For specific SQL syntax, this uses the SQLite dialect. | string | — | Yes |
params | Variables to use in conjunctions with query. This allows the query to be parameterized. This uses sqlite syntax (? or :name). | array, object, null | null | No |
preserve_data_types | Preserve Data Types value accepted by the runtime. | boolean | true | No |
| Formatting | ||||
preserve_index | Preserve Index value accepted by the runtime. | boolean | false | No |
| Conditions | ||||
if | Condition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}. | string | — | No |
where | Filter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'. | string | — | No |
where_params | Values 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
| header1 | header2 | header3 |
|---|---|---|
| 1 | a | x |
| 2 | b | y |
| 3 | c | z |
| header1 | header2 |
|---|---|
| 2 | b |
| 3 | c |
Access
| Requirement | Value |
|---|---|
| AI-powered | No |
| Requires WrangleWorks account | No |
| Requires subscription | No |
| Requires external API key | No |
Technical details
| Field | Value |
|---|---|
| Catalog ID | 94 |
| Catalog key | sql |
| Recipe key | sql |
| Catalog status | active |
| Lifecycle status | active |
| Recipe Writer eligible | Yes |
| Namespace | Root-level |
| Documentation group | compute |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.main.sql |
| Legacy UUID | 467a06b1-a697-4d31-8061-7d83a719fd79 |
Sources