All Products
Search
Document Center

Data Lake Analytics - Deprecated:Overview

Last Updated:Jul 25, 2019

Generally, you can run CREATE TABLE to create tables in DLA. For example, to create a mapping table in DLA for a MongoDB collection, run the following statement:

  1. create external table dla_person (
  2. id int,
  3. title varchar(127),
  4. age int,
  5. create_time timestamp
  6. )TBLPROPERTIES (
  7. TABLE_MAPPING = 'person',
  8. COLUMN_MAPPING = 'title,name'
  9. );

The CREATE statement must include all the fields in the person collection of the MongoDB database. If there are dozens or even hundreds of fields in the business-specific collection, it is time-consuming to manually enter these fields. To facilitate your operations, DLA provides the CREATE TABLE LIKE MAPPING function. When you create a table using CREATE TABLE LIKE MAPPING, you only need to specify the collection name or table name. DLA automatically queries a piece of sample data in the MongoDB collection, analyzes the fields and field types in the sample data, generates the corresponding table creation statement, and creates the table.

Examples