Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
Software Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Modifying Table Information

Updated on 2025-02-14 GMT+08:00

Function

This API is used to modify table information.

URI

PUT /v1/{project_id}/instances/{instance_id}/catalogs/{catalog_name}/databases/{database_name}/tables/{table_name}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For how to obtain the project ID, see Obtaining a Project ID.

instance_id

Yes

String

LakeFormation instance ID. The value is automatically generated when the instance is created, for example, 2180518f-42b8-4947-b20b-adfc53981a25.

catalog_name

Yes

String

Catalog name. The value should contain 1 to 256 characters. Only letters, numbers, and underscores (_) are allowed.

database_name

Yes

String

Database name. The value should contain 1 to 128 characters. Only letters, numbers, hyphens (-), and underscores (_) are allowed.

table_name

Yes

String

Table name. The value should contain 1 to 256 characters. Only letters, numbers, hyphens (-), and underscores (_) are allowed.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

Array of strings

Tenant token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

alter_params

No

Map<String,String>

Modify table parameter mapping information. The following parameters are supported: CASADE: whether to delete columns in the partition. If it is set to true, columns are deleted. DO_NOT_UPDATE_STATS: whether to update file-level statistics. If it is set to true, the system updates file-level statistics. STATS_GENERATED: initiator of the update. The options are TASK and USET. The role of the parameter is not clear.

table

Yes

UpdateTableInput object

Table input model.

Table 4 UpdateTableInput

Parameter

Mandatory

Type

Description

table_name

Yes

String

Table name. The value should contain 1 to 256 characters. Only letters, numbers, hyphens (-), and underscores (_) are allowed.

table_format

No

String

Table format. The value can be {HIVE or ICEBERG}. The default value is HIVE.

Enumeration values:

  • HIVE

  • ICEBERG

table_type

No

String

Table type. The options are MANAGED_TABLE (internal tables), EXTERNAL_TABLE (foreign tables), VIRTUAL_VIEW (views), MATERIALIZED_VIEW (materialized views), and DICTIONARY_TABLE (dictionary tables).

Enumeration values:

  • MANAGED_TABLE

  • EXTERNAL_TABLE

  • VIRTUAL_VIEW

  • MATERIALIZED_VIEW

  • DICTIONARY_TABLE

owner

No

String

Table owner. Enter 1 to 49 characters. Only letters, numbers, and underscores (_) are allowed.

owner_type

No

String

Owner type. The options are USER (user), GROUP (group), and ROLE (role).

Enumeration values:

  • USER

  • GROUP

  • ROLE

create_time

No

String

Table creation time.

last_access_time

No

String

Last access time.

last_analyzed_time

No

String

Last analyzed time.

partition_keys

No

Array of Column objects

Partition column information.

retention

No

Integer

Table retention period.

storage_descriptor

Yes

StorageDescriptor object

Data storage.

parameters

No

Map<String,String>

Table parameter information. Each key is a string that contains at least 1 byte but no more than 255 bytes. Each value is a UTF-8 string containing a maximum of 4000 bytes.

comments

No

String

Table description. Enter a maximum of 4,000 characters when you create the table.

view_expanded_text

No

String

If the table type is set to view, the value of this parameter is the extended text of a view; otherwise, the value is null.

view_original_text

No

String

If the table type is set to view, the value of this parameter is the original text of a view; otherwise, the value is null.

ignore_obs_checked

No

Boolean

Whether to ignore the constraints on the OBS path when creating an internal table.

external_table_id

No

String

User table ID, which is specified during creation and cannot be changed.

data_statistic_enable

No

Boolean

Whether to enable data overview statistics. By default, this feature is enabled at the table level. After changing its enabling status at the table level, you must verify its enabling status at the database level. For instance, if the feature at both the table and database levels is enabled, the data overview statistics function is enabled. Otherwise, this feature remains disabled.

version_id

No

String

Version ID, which can be input during modifications. By default, it uses the latest version.

Table 5 StorageDescriptor

Parameter

Mandatory

Type

Description

columns

Yes

Array of Column objects

All fields except partition columns.

location

No

String

Path, for example, obs://location/uri/.

compressed

Yes

Boolean

Whether to enable data compression. The default value is false.

input_format

No

String

Input format.

output_format

No

String

Output format.

number_of_buckets

No

Integer

Number of buckets. The default value is 0.

bucket_columns

No

Array of strings

Bucket field.

sort_columns

No

Array of Order objects

A list that specifies the bucket sorting method.

serde_info

Yes

SerDeInfo object

Serialization/Deserialization information.

parameters

Yes

Map<String,String>

Descriptor storage parameter. key can contain 255 characters at most. value can contain a maximum of 4,000 characters.

skewed_info

No

SkewedInfo object

Information about values (skewed values) that often appear in a column.

stored_as_sub_directories

No

Boolean

Whether to store data in subdirectories.

Table 6 Column

Parameter

Mandatory

Type

Description

column_type

Yes

String

Column type, including array, bigint, binary, boolean, char, date, decimal, double, float, int, interval, map, set, smallint, string, struct, timestamp, tinyint, union, and varchar.

column_name

Yes

String

Column name. The value can contain 1 to 767 characters. Only letters, digits, and special characters (_-+*(),) are allowed.

comment

No

String

Description of a column. Enter a maximum of 4,000 characters.

Table 7 Order

Parameter

Mandatory

Type

Description

column

No

String

Column name. The value can contain 1 to 767 characters. Only letters, digits, and special characters (_-+*(),) are allowed.

sort_order

No

Integer

Sorting method. The values are ==1 (ascending order) and ==0 (descending order).

Table 8 SerDeInfo

Parameter

Mandatory

Type

Description

name

No

String

Names.

serialization_library

No

String

Class that implements serialization/deserialization.

parameters

No

Map<String,String>

Parameters. The value of key ranges from 1 to 255. The maximum value of value is 4000.

Table 9 SkewedInfo

Parameter

Mandatory

Type

Description

skewed_column_names

Yes

Array of strings

List of skewed columns.

skewed_column_value_location_maps

Yes

Map<String,String>

Mapping between skew values and addresses.

skewed_column_values

Yes

Array<Array<String>>

List of skewed values.

Response Parameters

Status code: 200

Table 10 Response body parameters

Parameter

Type

Description

catalog_name

String

Catalog name.

catalog_id

String

catalogID.

database_name

String

Database name.

database_id

String

Database ID.

table_name

String

Table name.

table_id

String

Table ID.

table_status

Integer

Table status. The options are 0 (normal), 1 (deleted), 2 (restoring).

external_table_id

String

User table ID, which is specified during creation and cannot be changed.

create_time

String

Table creation time.

last_access_time

String

Last access time.

update_time

String

Table metadata last modification time.

last_analyzed_time

String

Last time when column-level statistics were calculated.

owner

String

User information.

owner_type

String

User type. The options are USER (user), GROUP (group), and ROLE (role).

Enumeration values:

  • USER

  • GROUP

  • ROLE

parameters

Map<String,String>

Parameter.

partition_keys

Array of Column objects

List of table partition columns.

retention

Integer

Table retention period.

storage_descriptor

StorageDescriptor object

Data storage.

table_format

String

Table format. The value can be {HIVE or ICEBERG}. The default value is HIVE.

Enumeration values:

  • HIVE

  • ICEBERG

table_type

String

Table type. The options are MANAGED_TABLE (internal tables), EXTERNAL_TABLE (foreign tables), VIRTUAL_VIEW (views), MATERIALIZED_VIEW (materialized views), and DICTIONARY_TABLE (dictionary tables).

Enumeration values:

  • MANAGED_TABLE

  • EXTERNAL_TABLE

  • VIRTUAL_VIEW

  • MATERIALIZED_VIEW

  • DICTIONARY_TABLE

comments

String

Table description.

view_expanded_text

String

If the table type is set to view, the value of this parameter is the extended text of a view; otherwise, the value is null.

view_original_text

String

If the table type is set to view, the value of this parameter is the original text of a view; otherwise, the value is null.

data_statistic_enable

Boolean

Whether to enable data overview statistics. By default, this feature is enabled at the table level. After changing its enabling status at the table level, you must verify its enabling status at the database level. For instance, if the feature at both the table and database levels is enabled, the data overview statistics function is enabled. Otherwise, this feature remains disabled.

version_id

String

Version ID.

Table 11 StorageDescriptor

Parameter

Type

Description

columns

Array of Column objects

All fields except partition columns.

location

String

Path, for example, obs://location/uri/.

compressed

Boolean

Whether to enable data compression. The default value is false.

input_format

String

Input format.

output_format

String

Output format.

number_of_buckets

Integer

Number of buckets. The default value is 0.

bucket_columns

Array of strings

Bucket field.

sort_columns

Array of Order objects

A list that specifies the bucket sorting method.

serde_info

SerDeInfo object

Serialization/Deserialization information.

parameters

Map<String,String>

Descriptor storage parameter. key can contain 255 characters at most. value can contain a maximum of 4,000 characters.

skewed_info

SkewedInfo object

Information about values (skewed values) that often appear in a column.

stored_as_sub_directories

Boolean

Whether to store data in subdirectories.

Table 12 Column

Parameter

Type

Description

column_type

String

Column type, including array, bigint, binary, boolean, char, date, decimal, double, float, int, interval, map, set, smallint, string, struct, timestamp, tinyint, union, and varchar.

column_name

String

Column name. The value can contain 1 to 767 characters. Only letters, digits, and special characters (_-+*(),) are allowed.

comment

String

Description of a column. Enter a maximum of 4,000 characters.

Table 13 Order

Parameter

Type

Description

column

String

Column name. The value can contain 1 to 767 characters. Only letters, digits, and special characters (_-+*(),) are allowed.

sort_order

Integer

Sorting method. The values are ==1 (ascending order) and ==0 (descending order).

Table 14 SerDeInfo

Parameter

Type

Description

name

String

Names.

serialization_library

String

Class that implements serialization/deserialization.

parameters

Map<String,String>

Parameters. The value of key ranges from 1 to 255. The maximum value of value is 4000.

Table 15 SkewedInfo

Parameter

Type

Description

skewed_column_names

Array of strings

List of skewed columns.

skewed_column_value_location_maps

Map<String,String>

Mapping between skew values and addresses.

skewed_column_values

Array<Array<String>>

List of skewed values.

Status code: 400

Table 16 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

solution_msg

String

Solution.

Status code: 404

Table 17 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

solution_msg

String

Solution.

Status code: 500

Table 18 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

solution_msg

String

Solution.

Example Requests

PUT https://{endpoint}/v1/{project_id}/instances/{instance_id}/catalogs/{catalog_name}/databases/{database_name}/tables/{table_name}

{
  "alter_params" : {
    "CASCADE" : "TRUE"
  },
  "table" : {
    "table_name" : "tbl08e39978e97b4266a7074fd92127e032",
    "table_format" : "HIVE",
    "table_type" : "EXTERNAL_TABLE",
    "owner" : "onebox",
    "owner_type" : "USER",
    "create_time" : "2023-05-31T02:06:58.000+00:00",
    "last_access_time" : "2023-05-31T02:06:58.000+00:00",
    "last_analyzed_time" : "2023-05-31T02:06:58.000+00:00",
    "partition_keys" : [ {
      "column_type" : "string",
      "column_name" : "column_prefix0",
      "comment" : "372f0f259ed049f5876050dcd13df630"
    }, {
      "column_type" : "string",
      "column_name" : "column_prefix1",
      "comment" : "6bb9dd73db49498d9aaabd343bfad689"
    } ],
    "retention" : 1000,
    "storage_descriptor" : {
      "columns" : [ {
        "column_type" : "string",
        "column_name" : "column_prefix0",
        "comment" : "4a4eca73554c4117b480fd73d8d6697b"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix1",
        "comment" : "5dc9df8676324e989440b0e6669d9338"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix2",
        "comment" : "b73c6fdb55594366bcd25c45ffbbee47"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix3",
        "comment" : "74fe507023414e2ba6137aaee059c3f9"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix4",
        "comment" : "4bd450c11ea24884875cd62e9d3e42dc"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix5",
        "comment" : "2457eea4a38e4ead8bbc065985279544"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix6",
        "comment" : "39b5869cea974e1488a47584acf4c313"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix7",
        "comment" : "90928727a6bb4c6ca2e3497ea9b31bf8"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix8",
        "comment" : "90d6544f85004c58a056891f7d00fbb2"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix9",
        "comment" : "8e993211dcad4adbacc360c9e5d0bbd9"
      } ],
      "location" : "obs://location/test/database/7b2fad385fd8434cbb8e759094a068cf",
      "compressed" : false,
      "input_format" : "9ea8ec4fc8dc4faaa8e5d1ed1e2db776",
      "output_format" : "ce56f7ea7a754a14a5c4525b296cc6f1",
      "number_of_buckets" : 0,
      "bucket_columns" : [ ],
      "sort_columns" : [ ],
      "serde_info" : {
        "name" : "f69aa43399ec498dbc42290d8e26ac6d",
        "serialization_library" : "fe216304f4f84411ba2d52b32688bfe6",
        "parameters" : {
          "f2d383124614470895a0ce2619bf3a32" : "69ee824ac98944d78f321af7a6edd538"
        }
      },
      "parameters" : {
        "dbc72b6d947e4d6f9a4b5ec081ebd07a" : "e5f22c513e984e3cb279ba5e40a2f69a",
        "64eb05edecae4722befd2e3575d3cbe8" : "656c632c586940649fcc1a4e62c8c0a1"
      },
      "skewed_info" : {
        "skewed_column_names" : [ ],
        "skewed_column_value_location_maps" : { },
        "skewed_column_values" : [ ]
      },
      "stored_as_sub_directories" : false
    },
    "parameters" : {
      "key1" : "value1",
      "transient_lastDdlTime" : "120",
      "classification" : "other"
    },
    "comments" : "comment info"
  }
}

Example Responses

Status code: 200

OK

{
  "catalog_name" : "hive",
  "database_name" : "dba",
  "table_name" : "www",
  "create_time" : "2022-11-19T03:10:14.000+00:00",
  "last_access_time" : "2022-12-31T23:59:59.000+00:00",
  "update_time" : null,
  "last_analyzed_time" : null,
  "owner" : "lakeformation",
  "owner_type" : "USER",
  "parameters" : {
    "ww" : "ww",
    "transient_lastDdlTime" : "1668827414",
    "classification" : "avro",
    "www" : "ww",
    "wwww" : "ww"
  },
  "partition_keys" : [ ],
  "retention" : 0,
  "storage_descriptor" : {
    "columns" : [ {
      "column_type" : "tinyint",
      "column_name" : "ww",
      "comment" : null
    } ],
    "location" : "obs://lakeformation/test",
    "compressed" : true,
    "input_format" : "org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat",
    "output_format" : "org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat",
    "number_of_buckets" : 0,
    "bucket_columns" : [ ],
    "sort_columns" : [ ],
    "serde_info" : {
      "name" : "name",
      "serialization_library" : "org.apache.hadoop.hive.serde2.avro.AvroSerDe",
      "parameters" : {
        "serialization.format" : "1"
      }
    },
    "parameters" : { },
    "skewed_info" : {
      "skewed_column_names" : [ ],
      "skewed_column_value_location_maps" : { },
      "skewed_column_values" : [ ]
    },
    "stored_as_sub_directories" : false
  },
  "table_type" : "MANAGED_TABLE",
  "comments" : "",
  "view_expanded_text" : "",
  "view_original_text" : ""
}

Status code: 400

Bad Request

{
  "error_code" : "common.01000001",
  "error_msg" : "failed to read http request, please check your input, code: 400, reason: Type mismatch., cause: TypeMismatchException"
}

Status code: 401

Unauthorized

{
  "error_code": 'APIG.1002',
  "error_msg": 'Incorrect token or token resolution failed'
}

Status code: 403

Forbidden

{
  "error" : {
    "code" : "403",
    "message" : "X-Auth-Token is invalid in the request",
    "error_code" : null,
    "error_msg" : null,
    "title" : "Forbidden"
  },
  "error_code" : "403",
  "error_msg" : "X-Auth-Token is invalid in the request",
  "title" : "Forbidden"
}

Status code: 404

Not Found

{
  "error_code" : "common.01000001",
  "error_msg" : "response status exception, code: 404"
}

Status code: 408

Request Timeout

{
  "error_code" : "common.00000408",
  "error_msg" : "timeout exception occurred"
}

Status code: 500

Internal Server Error

{
  "error_code" : "common.00000500",
  "error_msg" : "internal error"
}

Status Codes

Status Code

Description

200

OK

201

Created

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

408

Request Timeout

500

Internal Server Error

Error Codes

See Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback