AnalyticDB for MySQL allows you to submit import or export tasks asynchronously.

Submit a task asynchronously

  • Syntax
    submit job insert overwrite into xxx select ...

    After you execute the preceding statement, a job ID is returned.

  • Example
    mysql> submit job insert overwrite into test select * from test_external_table;
    +---------------------------------------+
    | job_id                               |
    +---------------------------------------+
    | 2017112122202917203100908203303000715 |

Query the status of an asynchronous task

  • Syntax
    show job status where job='job_id'
  • Example
    mysql> show job status where job='2017112122202917203100908203303000715';
    +---------------------------------------+-------------+---------+----------+-----------------------+-----------------------+--------------------------------------+
    | job_id                              | schema_name | status  | fail_msg | create_time           | update_time           | definition                           |
    +---------------------------------------+-------------+---------+----------+-----------------------+-----------------------+--------------------------------------+
    | 2017112122202917203100908203303000715 | test    | RUNNING | NULL     | 2017-11-21 22:20:31.0 | 2017-11-21 22:20:40.0 |  insert into test select * from test |
  • Task status
    • INIT: The task enters the queue.
    • RUNNING: The task is running.
    • FINISH or FAILED: The task succeeds or fails.

Terminate a task

  • Syntax
    cancel job 'job_id'
  • Example
    mysql> cancel job '2017112122202917203100908203303000715';
  • Description
    • Unscheduled, failed, and successful tasks are removed from the queue.
    • Running tasks are terminated. Imported data is rolled back.