The Treasure Data CLI (‘Command Line Interface’ or ‘Toolbelt’) allows you to create databases and tables, import or export data into and from the tables, set and modify the table schema, issue queries, monitor job status, view and download job results, create schedule queries, and much more.
Query the Sample Dataset
Treasure Data comes by default with a table called www_access in the database called sample_datasets.
Run the following query to calculate the distribution of HTTP status codes:
Issue Idempotent Queries by Domain Key for your Batch
Beginning with td command v0.14, the
td query command supports a
domain key. By means of a
domain key, clients can ensure the submission of queries becomes idempotent.
You can run your query. For example:
If the command has not responded with a job ID because of any API issue, you can issue the same query with the same domain key again safely.
Import Data into a Table
Importing your real data to the cloud from Application Logs, Middleware Logs, and other sources.
This example shows how to use the TD Toolbelt to generate a sample Apache log in JSON format and import it into a new table in the ‘own_database’ database.
Add the sample data.
$ td sample:apache sample_apache.json
$ td database:create own_database
Import the sample data into the own_database: