2016-05-12 13:35:27 +01:00
|
|
|
# odps table
|
2016-05-12 06:28:55 +01:00
|
|
|
|
2016-05-12 13:35:27 +01:00
|
|
|
> Create and modify tables in ODPS (Open Data Processing Service).
|
2016-05-12 06:28:55 +01:00
|
|
|
|
|
|
|
- Create a table with partition and lifecycle:
|
|
|
|
|
|
|
|
`create table {{table_name}} ({{col}} {{type}}) partitioned by ({{col}} {{type}}) lifecycle {{days}};`
|
|
|
|
|
|
|
|
- Create a table based on the definition of another table:
|
|
|
|
|
|
|
|
`create table {{table_name}} like {{another_table}};`
|
|
|
|
|
2016-05-12 11:16:03 +01:00
|
|
|
- Add partition to a table:
|
2016-05-12 06:28:55 +01:00
|
|
|
|
2016-05-16 10:18:34 +01:00
|
|
|
`alter table {{table_name}} add partition ({{partition_spec}});`
|
2016-05-12 06:28:55 +01:00
|
|
|
|
|
|
|
- Delete partition from a table:
|
|
|
|
|
|
|
|
`alter table {{table_name}} drop partition ({{partition_spec}});`
|
|
|
|
|
|
|
|
- Delete table:
|
|
|
|
|
|
|
|
`drop table {{table_name}};`
|