Help Center > > Developer Guide> Tutorial: Importing Data from OBS to a Cluster> Step 3: Importing Data

Step 3: Importing Data

Updated at: May 15, 2019 GMT+08:00
  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,
    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.

    INSERT INTO product_info SELECT * FROM product_info_ext;

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

    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)

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel