td_run>: Treasure Data saved queries

td_run> operator runs a query saved on Treasure Data.

Copy
Copied
_export:
  td:
    database: www_access

+step1:
  td_run>: 12345
+step2:
  td_run>: myquery2
  session_time: 2016-01-01T01:01:01+00:00

Examples

Secrets

When you don't know how to set secrets, please refer to Managing Workflow Secret

  • td.apikey : API_KEY The Treasure Data API key to use when running Treasure Data queries.

Options

  • td_run> : SAVED QUERY ID or SAVED QUERY NAME

    Runs saved query. If number was specified, it's considered as an ID of saved query. Otherwise it's considered as a name of a saved query.

    Examples:

    Copy
    Copied
    td_run>: 12345

    Examples:

    Copy
    Copied
    td_run>: my_query
  • download_file : NAME

    Saves query result as a local CSV file.

    Examples:

    Copy
    Copied
    download_file: output.csv
  • store_last_results : BOOLEAN

    Stores the first 1 row of the query results to ${td.last_results} variable (default: false). td.last_results is a map of column name and a value. To access to a single value, you can use ${td.last\_results.my\_count} syntax.

    Examples:

    Copy
    Copied
    store_last_results: true
  • preview : BOOLEAN

    Tries to show some query results to confirm the results of a query.

    Examples:

    Copy
    Copied
    preview: true
  • endpoint : ADDRESS

    API endpoint (default: api.treasuredata.com).

  • use_ssl : BOOLEAN

    Enable SSL (https) to access to the endpoint (default: true).

Output parameters

  • td.last_job_id or td.last_job.id

    The job id this task executed.

    Examples:

    Copy
    Copied
    52036074
  • td.last_results

    The first 1 row of the query results as a map. This is available only when store_last_results: true is set.

    Examples:

    Copy
    Copied
    {"path":"/index.html","count":1}
  • td.last_job.num_records

    The number of records of this job output.

    Examples:

    Copy
    Copied
    10