数据仓库服务 GAUSSDB(DWS)-CREATE PUBLIATION:示例

时间:2024-01-26 16:15:17

示例

  • 创建一个发布,发布两个表和两个模式中所有更改。

    创建示例表tpcds.ship_mode_t1:

    CREATE TABLE tpcds.ship_mode_t1
    (
        SM_SHIP_MODE_SK           INTEGER               NOT NULL,
        SM_SHIP_MODE_ID           CHAR(16)              NOT NULL,
        SM_TYPE                   CHAR(30)                      ,
        SM_CODE                   CHAR(10)                      ,
        SM_CARRIER                CHAR(20)                      ,
        SM_CONTRACT               CHAR(20)
    ) WITH (ORIENTATION = COLUMN, fine_disaster_table_role='primary', enable_disaster_cstore='on')
    DISTRIBUTE BY HASH(SM_SHIP_MODE_SK);

    创建示例表tpcds.customer_address_p1:

    CREATE TABLE tpcds.customer_address_p1
    (
        CA_ADDRESS_SK             INTEGER               NOT NULL,
        CA_ADDRESS_ID             CHAR(16)              NOT NULL,
        CA_STREET_NUMBER          CHAR(10)                      ,
        CA_STREET_NAME            VARCHAR(60)                   ,
        CA_STREET_TYPE            CHAR(15)                      ,
        CA_SUITE_NUMBER           CHAR(10)                      ,
        CA_CITY                   VARCHAR(60)                   ,
        CA_COUNTY                 VARCHAR(30)                   ,
        CA_STATE                  CHAR(2)                       ,
        CA_ZIP                    CHAR(10)                      ,
        CA_COUNTRY                VARCHAR(20)                   ,
        CA_GMT_OFFSET             DECIMAL(5,2)                  ,
        CA_LOCATION_TYPE          CHAR(20)
    ) WITH (ORIENTATION = COLUMN, fine_disaster_table_role='primary', enable_disaster_cstore='on')
    DISTRIBUTE BY HASH(CA_ADDRESS_SK);

    创建示例模式myschema1:

    CREATE SCHEMA myschema1;

    创建示例模式myschema2:

    CREATE SCHEMA myschema2;

    创建发布,发布两个表和两个模式中所有更改。

    CREATE PUBLICATION mypublication FOR TABLE users, departments, ALL TABLES IN SCHEMA myschema1, myschema2;
  • 创建一个发布,发布所有表中的所有更改。
    CREATE PUBLICATION alltables FOR ALL TABLES;
support.huaweicloud.com/sqlreference-820-dws/dws_06_0285.html