There are two ways to update a table Schema Management. Also, see Using Schema Annotation .


Using TD Console

To update schema manually, navigate to:

  1. Open TD Console.

  2. Navigate to Data Workbench > Databases.

  3. Select a database for which you want to modify the schema.
    For example, test_db or:


  4. Select a table.
    For example:


  5. Select Add Column.


  6. Specify the table metadata details.
    For example:


  7. Select Save.

  8. Optionally, to continue customizing the schema and metadata, select Edit Schema.


  9. Optionally, to continue customizing the schema and metadata, select Add Column.

  10. Optionally, to delete a column from your table, select Edit Schema and select the x to the far right of the page.

  11. Optionally, select … > Table Settings.


  12. Optionally, make selections on Edit Settings.


  13. Optionally, select Confirm.

  14. Select Save when your schema modification is complete.


Using TD CLI Tool

Alternatively, you can use the td schema:set command

  • where <column_name> consists of lowercase alphabets, numbers, and "_" only

  • where <type> can be one of the following:int, long, double, float, string, array<T>

  1. $ td schema:set <database> <table> <column_name>:<type>...

    For this example, the schema would be added as follows:

    td schema:set testdb www_access action:string labels:'array<string>' user:int

You can see the following articles for more query syntax:

Treasure Data, Presto, and Hive Schema Relation

Treasure Data

Presto

Hive

int

bigint

smallint

int

bigint

int

long

bigint

bigint

double

double

decimal

float

double

float

double

double

double

Convert to string or int

boolean

boolean

string

varchar

string or varchar

string or Convert to long

date

string

string or Convert to long

timestamp

timestamp

You can refer to the open-source documentation as well:


  • No labels