หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

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
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

Creating a Table (Discarded)

Function

This API is used to create a table. This API is a synchronous API.

NOTE:

This API has been discarded and is not recommended.

URI

  • URI format

    POST /v1.0/{project_id}/databases/{database_name}/tables

  • Parameter description
    Table 1 URI parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID.

    database_name

    Yes

    String

    Name of the database where the new table resides.

Request

Table 2 Request parameters

Parameter

Mandatory

Type

Description

table_name

Yes

String

Name of the created table.

  • The table name can contain only digits, letters, and underscores (_), but cannot contain only digits or start with an underscore (_).
  • The table name is case insensitive and cannot be left unspecified.
  • The table name can contain the dollar sign ($). Example: $test
  • The length of the database name cannot exceed 128 characters.

data_location

Yes

String

Location where data is stored. The options are as follows:

  • OBS: OBS table
  • DLI: DLI table
  • VIEW: VIEW table

description

No

String

Information about the new table.

columns

Yes

Array of Objects

Columns of the new table. For details about column parameters, see Table 4. This parameter is optional when data_location is VIEW.

select_statement

No

String

Query statement required for creating a view. The database to which the table belongs needs to be specified in the query statement, in the format of database.table. This parameter is mandatory when data_location is VIEW.

data_type

No

String

Type of the data to be added to the OBS table. The options are as follows: Parquet, ORC, CSV, JSON, and Avro.

NOTE:

This parameter is mandatory for an OBS table.

data_path

No

String

Storage path of data in the new OBS table, which must be a path on OBS and must begin with obs.

NOTE:

This parameter is mandatory for an OBS table.

Do not set this parameter to the OBS root directory. Otherwise, all data in the root directory will be cleared when you clear table data.

with_column_header

No

Boolean

Whether the table header is included in the OBS table data. Only data in CSV files has this attribute. This parameter is mandatory when data_location is OBS.

delimiter

No

String

User-defined data delimiter. Only data in CSV files has this attribute. This parameter is mandatory when data_location is OBS.

quote_char

No

String

User-defined reference character. Double quotation marks ("\") are used by default. Only data in CSV files has this attribute. This parameter is mandatory when data_location is OBS.

escape_char

No

String

User-defined escape character. Backslashes (\\) are used by default. Only data in CSV files has this attribute. This parameter is mandatory when data_location is OBS.

date_format

No

String

User-defined date type. yyyy-MM-dd is used by default. For details about the characters involved in the date format, see Table 3. Only data in CSV and JSON files has this attribute. This parameter is mandatory when data_location is OBS.

timestamp_format

No

String

User-defined timestamp type. yyyy-MM-dd HH:mm:ss is used by default. For definitions about characters in the timestamp format, see Table 3. Only data in CSV and JSON files has this attribute. This parameter is mandatory when data_location is OBS.

tags

No

Array of objects

Database tag. For details about this object, see tags parameters.

Table 3 tags parameters

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key

NOTE:

A tag key can contain a maximum of 128 characters. Only letters, digits, spaces, and special characters (_.:=+-@) are allowed, but the value cannot start or end with a space or start with _sys_.

value

Yes

String

Tag value

NOTE:

A tag value can contain a maximum of 255 characters. Only letters, digits, spaces, and special characters (_.:=+-@) are allowed. The value cannot start or end with a space.

Table 4 columns parameters

Parameter

Mandatory

Type

Description

column_name

Yes

String

Name of a column.

type

Yes

String

Data type of a column.

description

No

String

Description of a column.

is_partition_column

No

Boolean

Whether the column is a partition column. The value true indicates a partition column, and the value false indicates a non-partition column. The default value is false.

NOTE:

When creating a partition table, ensure that at least one column in the table is a non-partition column. For details, see "Request example".

Response

Table 5 Response parameters

Parameter

Mandatory

Type

Description

is_success

No

Boolean

Whether the request is successfully executed. Value true indicates that the request is successfully executed.

message

No

String

System prompt. If execution succeeds, the parameter setting may be left blank.

Example Request

  • Create a table whose data_location is OBS and data format of CSV.
    {
      "table_name": "tb1",
      "data_location": "OBS",
      "description": "",
      "data_type": "csv",
      "data_path": "obs://obs/path1",
      "columns": [
      {
         "column_name": "column1",
         "type": "string",
         "description": "",
         "is_partition_column": true
      },
      {
         "column_name": "column2",
         "type": "string",
         "description": "",
         "is_partition_column": false
      }
      ],
      "with_column_header": true,
      "delimiter": ",",
      "quote_char": "\"",
      "escape_char": "\\",
      "date_format": "yyyy-MM-dd",
      "timestamp_format": "yyyy-MM-dd HH:mm:ss"
    }
    NOTE:

    The values of date_format and timestamp_format must be the same as the time format in the imported CSV file.

  • Create a table whose data_location is DLI.
    {
      "table_name": "tb2", 
      "data_location": "DLI", 
      "columns": [
        {
          "column_name": "column1", 
          "type": "string", 
          "description": "", 
          "is_partition_column": true
        }, 
        {
          "column_name": "column2", 
          "type": "string", 
          "description": "", 
          "is_partition_column": false
        }
      ], 
      "tags": [
        {
          "key": "quarterly", 
          "value": "Q3"
        }, 
        {
          "key": "author", 
          "value": "user"
        }
      ]
    }
  • Create a table whose data_location is VIEW.
    {
      "table_name": "tb3",
      "data_location": "VIEW",
      "columns": [
      {
         "column_name": "column1",
         "type": "string",
         "description": "",
         "is_partition_column": true
      },
      {
         "column_name": "column2",
         "type": "string",
         "description": "",
         "is_partition_column": false
      }
      ],
      "select_statement": "select * from db1.tb1"
    }

Example Response

{
  "is_success": true,
  "message": ""
}

Status Codes

Table 6 describes the status code.

Table 6 Status codes

Status Code

Description

200

The job is created successfully.

400

Request error.

500

Internal service error.

Error Codes

If an error occurs when this API is invoked, the system does not return the result similar to the preceding example, but returns the error code and error information. For details, see Error Codes.

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback