• Data Warehouse Service

  1. Help Center
  2. Data Warehouse Service
  3. Developer Guide
  4. Tutorial: Importing Data from OBS to a Cluster
  5. Step 3: Importing Data

Step 3: Importing Data

  1. Create a table named product_info in the DWS database to store the data imported from OBS.

    DROP TABLE IF EXISTS product_info;
    CREATE TABLE product_info
        product_price                integer        not null,
        product_id                   char(30)       not null,
        product_time                 date           ,
        product_level                char(10)       ,
        product_name                 varchar(200)   ,
        product_type1                varchar(20)    ,
        product_type2                char(10)       ,
        product_monthly_sales_cnt    integer        ,
        product_comment_time         date           ,
        product_comment_num          integer        ,
        product_comment_content      varchar(200)                   
    WITH (
    orientation = column,
    DISTRIBUTE BY hash (product_id);

  2. Run INSERT to import data from OBS to the target table product_info through the foreign table product_info_ext.

    INSERT INTO product_info SELECT * FROM product_info_ext;

  3. Run SELECT to view the data imported to the target table product_info.

    SELECT * FROM product_info;

    If the query result displays data specified in Preparing Data Files, the import is successful. The following information is displayed at the end of the query result:

    (20 rows)