Skip to content
Last updated

Exporting and Running a Daily Query

The simple workflow template exports and runs a query daily.

Specifies Treasure Data database the workflow will run against

_export:
  td:
    database: workflow_temp

If it specifies td.database secret parameter is set to the workflow project, the database parameter in YAML is not used.

Runs the query that is provided by Treasure Data. The daily_open query aggregates the average opening and closing price of Nasdaq stocks, per day, as captured in the sample_datasets.nasdaq provided by Treasure Data.

+daily:
  td>: queries/daily_open.sql

Executes a “Drop table if exists + create table as” operation, creating the new table based on the output of the task’s query. The table that is created contains the aggregated price.

create_table: daily_open

Similarly, the second specified task, runs a query that is provided by Treasure Data. The monthly_open query aggregates the average opening and closing price of Nasdaq stocks, per month.

+monthly:
  td>: queries/monthly_open.sql

Creates a table that contains the aggregated price

create_table: monthly_open

The + signifies a new task. The text that follows before the : is the name you give the task.

The td> signifies that the query that follows will run in the Treasure Data environment. This is automatically set to run a Presto query. The > signifies that this is where the “action” part of the task is defined—the specific processing to run.