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

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

CREATE TABLE

Updated on 2025-01-09 GMT+08:00

Function

This command creates a Delta table by specifying a list of fields with table attributes.

Precautions

  • In this command, IF EXISTS and db_name are optional.
  • In DLI, Delta only supports OBS foreign tables. Creating a table using a table name without specifying the location will fail.

Syntax

  • Create a Delta table by table name.

    CREATE[ OR REPLACE] TABLE [ IF NOT EXISTS] [database_name.]table_name

    [ (columnTypeList)]

    USING DELTA

    [ COMMENT table_comment ]

    [ PARTITIONED BY (partColumnList) ]

    LOCATION location_path

  • Create a Delta table by delta.'Obs path'.

    CREATE[ OR REPLACE] TABLE [ IF NOT EXISTS] DELTA.`obs://bucket_name/tbl_path`

    [ (columnTypeList)]

    USING DELTA

    [ COMMENT table_comment ]

    [ PARTITIONED BY (partColumnList) ]

NOTE:

Creating a table by table name allows the table to be found with show tables. In the current version, the location must be specified and can only be set to an OBS path. Creating a table by delta.'Obs path' means the table cannot be found with show tables.

Parameter Description

Table 1 Parameter descriptions of CREATE TABLE

Parameter

Description

database_name

Name of the database, consisting of letters, numbers, and underscores (_)

table_name

Name of the table in the database, consisting of letters, numbers, and underscores (_)

bucket_name

Name of the OBS bucket

tbl_path

Storage location of the Delta table in the OBS bucket

columnTypeList

Comma-separated list with data types. Column names consist of letters, numbers, and underscores (_).

using

Parameter delta, defines and creates the Delta table

table_comment

Description of the table

partColumnList

List of partition fields, with column names from columnTypeList

location_path

Storage location of the Delta table. In the current version, it must be specified and can only support OBS paths. Specifying this path creates the Delta table as a foreign table.

Required Permissions

  • SQL permissions
    Table 2 Permissions required for executing CREATE TABLE

    Permission Description

    CREATE_TABLE permission on the database

  • Fine-grained permission: dli:database:createTable
  • Metadata services provided by LakeFormation. Refer to the LakeFormation documentation for details on permission configuration.

Examples

  • Create a non-partitioned table by table name.
    create table if not exists delta_table0 (
    id int,
    name string,
    addr struct<priv:string,city:string>,
    price double
    ) using delta
    location 'obs://bucket_name0/db0/delta_table0';
  • Create a partitioned table by table name.
    create table if not exists delta_table0 (
    id bigint,
    name string,
    ts bigint,
    dt string,
    hh string
    ) using delta
    partitioned by (dt, hh)
    location 'obs://bucket_name0/db0/delta_table0';
  • Create a non-partitioned table by delta path.
    create table if not exists delta.`obs://bucket_name0/db0/delta_table0`(
    id int,
    name string,
    price double
    ) using delta;
  • Create a partitioned table by delta path.
    create table if not exists delta.`obs://bucket_name0/db0/delta_table0` (
    id bigint,
    name string,
    ts bigint,
    dt string,
    hh string
    ) using delta
    partitioned by (dt, hh);
  • Create a table using create table like.
    create table delta_table2 like delta_table1 
    using delta
    location 'obs://bucket_name0/db0/delta_table2';

System Response

Displays the successful creation of the table.

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

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback