You can write job results from Treasure Data directly to Airship Audience Lists. In Airship, you can then use the List to target specific users.

This topic contains:

Prerequisites

  • Basic Knowledge of Treasure Data.

  • Basic knowledge of Airship / Airship Audience Lists

Limitations

  • Due to API functions, you can override the list content; you cannot append the list.

  • You can upload up to 10 million records.

  • You can create up to 100 uploaded lists.

Use the TD Console to Create Your Connection

Create a New Connection

In Treasure Data, you must create and configure the data connection prior to running your query. As part of the data connection, you provide authentication to access the integration.

  1. Open TD Console.

  2. Navigate to Integrations HubCatalog.

  3. Click the search icon on the far-right of the Catalog screen, and enter Airship.
  4. Hover over the AirShip connector and select Create Authentication.

          The following dialog opens.
  5. Enter the Base URL:

  6. Choose an authentication method.

  7. Enter a name for your connection.

  8. Select Continue.

Authentication Method

Select the Basic or Access token method.

For the Basic authentication method:

  1. In the Airship project dashboard, select the Settings > APIs & Integrations.

  2. Enter the App key, App secret, and App master secret.

For the Access token authentication method:

  1. In the Airship project dashboard, select the Settings > APIs & Integrations > Tokens.

  2. Create a new token and grant Audience Modification or All-access Role.

Configure Export Results in Your Data Connection

Configure the data connection.

Column name

Data type

Required

Example

identifier_type

string

Yes

ios_channel

identifier

string

Yes


Example

SELECT identifier_type, identifier
FROM table my_table

Configure the Connection by Specifying the Parameters

  1. Open the TD Console.

  2. Navigate to Data Workbench > Queries.

  3. Click New Query to create a new query or search for a saved query that you plan to use to export data.

  4. At the top of your query editor, select Export Results

The Choose Integration dialog opens. You can use an existing connection or create a new connection for your export.

Use an existing connection

  1. Type the connection name in the search box.

  2. Select your connection.

  3. Set the following parameters:

Parameter

Description

List Name (required)

Audience List name

Description (optional)

Audience List description

Skip Empty Records (optional)

The default is True. If the query result contains an empty or null column, the row will be skipped, otherwise, the job will fail and you need to remove empty records manually.

Optionally Schedule the Query Export Jobs

You can use Scheduled Jobs with Result Export to periodically write the output result to a target destination that you specify.


1. Navigate to Data Workbench > Queries.
2. Create a new query or select an existing query.
3. Next to Schedule, select None.

4. In the drop-down, select one of the following schedule options.

Drop-down ValueDescription
Custom cron...

Review Custom cron... details.

@daily (midnight)Run once a day at midnight (00:00 am) in the specified time zone.
@hourly (:00)Run every hour at 00 minutes.
NoneNo schedule.

Custom cron... Details

Cron Value

Description

0 * * * *

Run once an hour

0 0 * * *

Run once a day at midnight

0 0 1 * *

Run once a month at midnight on the morning of the first day of the month

""

Create a job that has no scheduled run time.

 *    *    *    *    *
 -    -    -    -    -
 |    |    |    |    |
 |    |    |    |    +----- day of week (0 - 6) (Sunday=0)
 |    |    |    +---------- month (1 - 12)
 |    |    +--------------- day of month (1 - 31)
 |    +-------------------- hour (0 - 23)
 +------------------------- min (0 - 59)

The following named entries can be used:

  • Day of Week: sun, mon, tue, wed, thu, fri, sat

  • Month: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec

A single space is required between each field. The values for each field can be composed of:

Field ValueExampleExample Description

a single value, within the limits displayed above for each field.



a wildcard ‘*’ to indicate no restriction based on the field. 

‘0 0 1 * *’ configures the schedule to run at midnight (00:00) on the first day of each month.
a range ‘2-5’, indicating the range of accepted values for the field.‘0 0 1-10 * *’ configures the schedule to run at midnight (00:00) on the first 10 days of each month.
a list of comma-separated values ‘2,3,4,5’, indicating the list of accepted values for the field.

0 0 1,11,21 * *’


configures the schedule to run at midnight (00:00) every 1st, 11th, and 21st day of each month.
a periodicity indicator ‘*/5’ to express how often based on the field’s valid range of values a schedule is allowed to run.

‘30 */2 1 * *’


configures the schedule to run on the 1st of every month, every 2 hours starting at 00:30. ‘0 0 */5 * *’ configures the schedule to run at midnight (00:00) every 5 days starting on the 5th of each month.
a comma-separated list of any of the above except the ‘*’ wildcard is also supported ‘2,*/5,8-10’‘0 0 5,*/10,25 * *’configures the schedule to run at midnight (00:00) every 5th, 10th, 20th, and 25th day of each month.
5.  (Optional) If you enabled the Delay execution, you can delay the start time of a query.

Execute the Query

Save the query with a name and run, or just run the query. Upon successful completion of the query, the query result is automatically imported to the specified container destination.


Scheduled jobs that continuously fail due to configuration errors may be disabled on the system side after several notifications.



Optionally Configure Export Results in Workflow

Within Treasure Workflow, you can specify the use of a data connector to export data.

Learn more at Using Workflows to Export Data with the TD Toolbelt.

timezone: UTC

_export:
  td:
    database: sample_datasets

+td-result-into-target:
  td>: queries/sample.sql
  result_connection: airship
  result_settings:
    list_name: 'td uploaded list'
    list_description: 'ios and android channels'
  • No labels