Step 3: Importing Data

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

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    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,
    compression=middle
    ) 
    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.

    1
    INSERT INTO product_info SELECT * FROM product_info_ext;
    

  3. Run SELECT to view the data imported to the target table product_info in GaussDB(DWS).

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