This topic describes how to create a MySQL table and read data from the table in Data Lake Analytics (DLA).

  1. Log on to the DLA console.
  2. In the left-side navigation pane, click SQL access endpoint. On the page that appears, find your VPC and click Log on in DMS in the Actions column. Then, execute the following SQL statement to create a MySQL table:
    CREATE EXTERNAL TABLE hello_mysql_vpc_rds.tbl_person (
        id int,
        name varchar(1023),
        age int
    ) tblproperties (
        table_mapping = "person"
    );

Query data from the MySQL database

After you create a MySQL schema and table in DLA, you can use the MySQL client or MySQL CLI to connect to DLA. Then, you can use standard SQL statements to read and write data to the MySQL table.

mysql> select * from person;
+------+-------+------+
| id   | name  | age  |
+------+-------+------+
|    1 | james |   10 |
|    2 | bond  |   20 |