Tables

Create partial delete job

Creates a partial delete job.

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
table_name
required
string
Example: Bravo
Request Body schema: application/x-www-form-urlencoded
domain_key
string (DomainKey)
Timestamp (integer) or DateTimeAsString (string) or DateTimeISO8601 (string)
pool_name
string
Timestamp (integer) or DateTimeAsString (string) or DateTimeISO8601 (string)
Responses
200

OK

post/table/partialdelete/{database_name}/{table_name}
Request samples
curl -i -X POST \
  'https://api.treasuredata.com/v3/table/partialdelete/{database_name}/{table_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/x-www-form-urlencoded'
Response samples
application/json
{
  • "job_id": 19,
  • "database": "Alpha",
  • "table": "Bravo",
  • "from": 1356998400,
  • "to": 1356998400
}

Get tables

Retrieves a list of tables according to database specified.

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
Responses
200

OK

get/table/list/{database_name}
Request samples
curl -i -X GET \
  'https://api.treasuredata.com/v3/table/list/{database_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'
Response samples
application/json
{
  • "database": "Alpha",
  • "tables": [
    ]
}

Get tables

Shows a table according to specified database and table.

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
table_name
required
string
Example: Bravo
Responses
200

OK

get/table/show/{database_name}/{table_name}
Request samples
curl -i -X GET \
  'https://api.treasuredata.com/v3/table/show/{database_name}/{table_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'
Response samples
application/json
{
  • "id": 11,
  • "count": 1000,
  • "counter_updated_at": { },
  • "created_at": "2020-12-31 11:22:33 UTC",
  • "delete_protected": true,
  • "estimated_storage_size": 1073741824,
  • "expire_days": 30,
  • "include_v": false,
  • "last_log_timestamp": 1356998400,
  • "name": "Bravo",
  • "schema": "string",
  • "type": "log",
  • "updated_at": "2020-12-31 11:22:33 UTC"
}

Delete table

Deletes specified table.

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
table_name
required
string
Example: Bravo
Responses
200

OK

post/table/delete/{database_name}/{table_name}
Request samples
curl -i -X POST \
  'https://api.treasuredata.com/v3/table/delete/{database_name}/{table_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'
Response samples
application/json
{
  • "database": "Alpha",
  • "table": "Bravo",
  • "type": "log"
}

Create table

Creates a table.

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
table_name
required
string
Example: Bravo
query Parameters
idempotent_key
string (IdempotentKey)
Responses
200

OK

post/table/create/{database_name}/{table_name}
Request samples
curl -i -X POST \
  'https://api.treasuredata.com/v3/table/create/{database_name}/{table_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'
Response samples
application/json
{
  • "database": "Alpha",
  • "table": "Bravo",
  • "type": "log"
}

Update table

Updates a table.

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
table_name
required
string
Example: Bravo
Request Body schema: application/x-www-form-urlencoded
detect_schema
boolean
expire_days
integer or null
include_v
boolean

when true, Hive queries can access a virtual column "v" which contains a map of every data column's name to its value (represented as a string). Prefer to set a schema on the table instead of using "v".

name
string
schema
string
ignore_duplicate_schema
boolean
overwrite
boolean

wheter to override a possible existing table in case of updating the name

Responses
200

OK

post/table/update/{database_name}/{table_name}
Request samples
curl -i -X POST \
  'https://api.treasuredata.com/v3/table/update/{database_name}/{table_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/x-www-form-urlencoded'
Response samples
application/json
{
  • "database": "Alpha",
  • "table": "Bravo",
  • "type": "log"
}

Rename table

Renames a specified table.

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
current_table_name
required
string
Example: Bravo
new_table_name
required
string
Example: Bravo
Responses
200

OK

post/table/rename/{database_name}/{current_table_name}/{new_table_name}
Request samples
curl -i -X POST \
  'https://api.treasuredata.com/v3/table/rename/{database_name}/{current_table_name}/{new_table_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'
Response samples
application/json
{
  • "database": "Alpha",
  • "table": "Bravo",
  • "type": "log"
}

Swap tables

Swaps specified tables.

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
table_name_1
required
string
Example: Bravo
table_name_2
required
string
Example: Bravo
Responses
200

OK

post/table/swap/{database_name}/{table_name_1}/{table_name_2}
Request samples
curl -i -X POST \
  'https://api.treasuredata.com/v3/table/swap/{database_name}/{table_name_1}/{table_name_2}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'
Response samples
application/json
{
  • "database": "Alpha",
  • "table1": "Bravo",
  • "table2": "Bravo"
}

Tail table

Shows the last record in a table. IS THIS CORRECT FOR A TAIL?

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
table_name
required
string
Example: Bravo
path_format
required
string
Enum: "json" "msgpack"
query Parameters
format
string
Enum: "json" "msgpack"
Responses
200

OK

get/table/tail/{database_name}/{table_name}{path_format}
Request samples
curl -i -X GET \
  'https://api.treasuredata.com/v3/table/tail/{database_name}/{table_name}{path_format}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'
Response samples
[
  • "string"
]

Get table distribution

Retrieve a table distribution.

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
table_name
required
string
Example: Bravo
Responses
200

OK

get/table/distribution/{database_name}/{table_name}
Request samples
curl -i -X GET \
  'https://api.treasuredata.com/v3/table/distribution/{database_name}/{table_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'
Response samples
application/json
{
  • "bucket_count": 50,
  • "partition_function": "hash",
  • "columns": [
    ]
}

Change database

Changes to the specified table database.

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
table_name
required
string
Example: Bravo
Request Body schema: application/x-www-form-urlencoded
dest_database_name
required
string

database name

Responses
200

OK

post/table/change_database/{database_name}/{table_name}
Request samples
curl -i -X POST \
  'https://api.treasuredata.com/v3/table/change_database/{database_name}/{table_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d dest_database_name=Alpha
Response samples
application/json
{
  • "database": "Alpha",
  • "table": "Bravo",
  • "type": "log"
}

Transfer table to a different account

Tranfers the specified table to a different account.

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
table_name
required
string
Example: Bravo
Request Body schema: application/x-www-form-urlencoded
dest_database_name
required
string

database name

dest_table_name
required
string
idempotent_key
string (IdempotentKey)
Responses
200

OK

post/table/transfer/{database_name}/{table_name}
Request samples
curl -i -X POST \
  'https://api.treasuredata.com/v3/table/transfer/{database_name}/{table_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d dest_database_name=Alpha \
  -d dest_table_name=Bravo
Response samples
application/json
{
  • "database_name": "string",
  • "table_name": "string"
}

Append table schema

Appends the specified table schema.

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
table_name
required
string
Example: Bravo
Request Body schema: application/x-www-form-urlencoded
required
Array of Array of TableSchemaAsArray (strings) or TableSchemaAsString (string)
Responses
200

OK

post/table/append-schema/{database_name}/{table_name}
Request samples
curl -i -X POST \
  'https://api.treasuredata.com/v3/table/append-schema/{database_name}/{table_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'schema=name,string,first_name,creation_date,long'
Response samples
application/json
{
  • "database": "Alpha",
  • "table": "Bravo",
  • "type": "log"
}

Update table schema

Updates the specified table schema.

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
table_name
required
string
Example: Bravo
Request Body schema: application/x-www-form-urlencoded
required
Array of Array of TableSchemaAsArray (strings) or TableSchemaAsString (string)
ignore_duplicate_schema
boolean
detect_schema
boolean
Responses
200

OK

post/table/update-schema/{database_name}/{table_name}
Request samples
curl -i -X POST \
  'https://api.treasuredata.com/v3/table/update-schema/{database_name}/{table_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'schema=name,string,first_name,creation_date,long'
Response samples
application/json
{
  • "database": "Alpha",
  • "table": "Bravo",
  • "type": "log"
}
Support
Copyright © 2021 Treasure Data, Inc. (or its affiliates). All rights reserved.