Step 3: Importing Data
- 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);
- 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;
- If information similar to the following is displayed, the data has been imported. Query the error table for data format errors. For details, see Step 4: Analyzing and Handling Import Errors.
1
INSERT 0 20
- If there are import errors, troubleshoot by following instructions provided in Step 4: Analyzing and Handling Import Errors and try again.
- If information similar to the following is displayed, the data has been imported. Query the error table for data format errors. For details, see Step 4: Analyzing and Handling Import Errors.
- 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)
Last Article: Step 2: Creating a Foreign Table
Next Article: Step 4: Analyzing and Handling Import Errors
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.