All Products
Search
Document Center

Data Lake Analytics - Deprecated:Insert data into OSS

Last Updated:May 09, 2019

This topic describes how to write data to OSS in DLA.

  1. Create an OSS schema in DLA.

    1. CREATE SCHEMA oss_schema with DBPROPERTIES(
    2. catalog='oss',
    3. location = 'oss://mybucket/datasets/****/test/convert/'
    4. );
  2. Create a table named orders_txt in DLA.

    1. CREATE EXTERNAL TABLE orders_txt (
    2. O_ORDERKEY INT,
    3. O_CUSTKEY INT,
    4. O_ORDERSTATUS STRING,
    5. O_TOTALPRICE DOUBLE,
    6. O_ORDERDATE DATE,
    7. O_ORDERPRIORITY STRING,
    8. O_CLERK STRING,
    9. O_SHIPPRIORITY INT,
    10. O_COMMENT STRING
    11. )
    12. ROW FORMAT DELIMITED FIELDS TERMINATED BY '|'
    13. STORED AS TEXTFILE LOCATION 'oss://mybucket/datasets/****/test/convert/orders.tbl';
  3. Create a table named orders_orc in DLA.

    1. REATE EXTERNAL TABLE orders_orc (
    2. O_ORDERKEY INT,
    3. O_CUSTKEY INT,
    4. O_ORDERSTATUS STRING,
    5. O_TOTALPRICE DOUBLE,
    6. O_ORDERDATE DATE,
    7. O_ORDERPRIORITY STRING,
    8. O_CLERK STRING,
    9. O_SHIPPRIORITY INT,
    10. O_COMMENT STRING
    11. )
    12. STORED AS ORC LOCATION 'oss://mybucket/datasets/****/test/convert/orders_orc/';
  4. Execute the INSERT… SELECT statement to insert data records that meet the specified filter criteria from orders_txt to orders_orc.

    1. INSERT INTO orders_orc SELECT * FROM orders_txt;