You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
id: api_python_sqlnamespace: blueprinttasks:
- id: extracttype: io.kestra.plugin.fs.http.Downloaduri: https://dummyjson.com/products
- id: transformtype: io.kestra.plugin.scripts.python.Scriptdocker:
image: python:3.11-alpine # 57 MBinputFiles:
data.json: "{{ outputs.extract.uri }}"outputFiles:
- "*.json"script: | import json with open("data.json", 'r') as file: data = json.load(file) filtered_data = [{"brand": product["brand"], "price": product["price"]} for product in data["products"]] with open("products.json", 'w') as file: json.dump(filtered_data, file, indent=4)
- id: sqlQuerytype: io.kestra.plugin.jdbc.duckdb.QueryinputFiles:
products.json: "{{ outputs.transform.outputFiles['products.json'] }}"sql: | INSTALL json; LOAD json; SELECT brand, round(avg(price), 2) as avg_price FROM read_json_auto('{{ workingDir }}/products.json') # ❌ this is error-prone and not intuitive GROUP BY brand ORDER BY avg_price DESC;store: true
Ideally, the same should work by using:
...
- id: sqlQuerytype: io.kestra.plugin.jdbc.duckdb.QueryinputFiles:
products.json: "{{ outputs.transform.outputFiles['products.json'] }}"sql: | INSTALL json; LOAD json; SELECT brand, round(avg(price), 2) as avg_price FROM read_json_auto('products.json') GROUP BY brand ORDER BY avg_price DESC;store: true
The text was updated successfully, but these errors were encountered:
Feature description
See an example:
Ideally, the same should work by using:
The text was updated successfully, but these errors were encountered: