-- Load files in the orders directory with timestamps newer than the time of the
-- previous poll interval; poll every 5 minutes
LOADDATAINTOexample.ordersFROMFILEPATHS'orders/'WITHOPTIONS(DATASOURCE='example.order_ds',SUBSCRIBE=TRUE,POLL_INTERVAL=300)
LOADINTOexample.employee_dept2FROMREMOTEQUERY'SELECT * FROM example.employee WHERE dept_id = 2'WITHOPTIONS(DATASOURCE='example.jdbc_ds')
Change Data Capture
1
2
3
4
5
6
7
8
9
10
-- Load new orders for product 42 continuously into a table
-- order_id is an ever-increasing sequence allotted to each new order
LOADINTOexample.order_product42FROMREMOTEQUERY'SELECT * FROM example.orders WHERE product_id = 42'WITHOPTIONS(DATASOURCE='example.jdbc_ds',SUBSCRIBE=TRUE,REMOTE_QUERY_INCREASING_COLUMN='order_id')
Init Options
1
2
3
4
5
6
7
LOADINTOexample.tsFROMREMOTEQUERY'SELECT ts FROM example.ts_source'WITHOPTIONS(DATASOURCE='example.jdbc_ds',JDBC_SESSION_INIT_STATEMENT='SET TIME ZONE ''EST''')
Sizing Options
1
2
3
4
5
6
7
8
LOADINTOexample.employee_dept2FROMREMOTEQUERY'SELECT * FROM example.employee WHERE dept_id = 2'WITHOPTIONS(DATASOURCE='example.jdbc_ds',BATCHSIZE=10000,JDBC_FETCH_SIZE=10000)
LOADINTOexample.employee_localFROMREMOTEQUERY'SELECT * FROM example.employee'WITHOPTIONS(DATASOURCE='example.jdbc_ds',REMOTE_QUERY_PARTITION_COLUMN='id')
Ordered Blocks
1
2
3
4
5
6
7
LOADINTOexample.employee_localFROMREMOTEQUERY'SELECT * FROM example.employee'WITHOPTIONS(DATASOURCE='example.jdbc_ds',REMOTE_QUERY_ORDER_BY='hire_date, dept_id')
Disable Partitioning
1
2
3
4
5
6
7
LOADINTOexample.employee_localFROMREMOTEQUERY'SELECT * FROM example.employee'WITHOPTIONS(DATASOURCE='example.jdbc_ds',REMOTE_QUERY_NO_SPLIT=true)
Rank/Split Processing
1
2
3
4
5
6
7
8
LOADINTOexample.employee_localFROMREMOTEQUERY'SELECT * FROM example.employee'WITHOPTIONS(DATASOURCE='example.jdbc_ds',NUM_SPLITS_PER_RANK=16,NUM_TASKS_PER_RANK=4)
CREATEEXTERNALTABLEexample.ext_employee_dept2REMOTEQUERY'SELECT * FROM example.employee WHERE dept_id = 2'WITHOPTIONS(DATASOURCE='example.jdbc_ds')
Query Change Data Capture
1
2
3
4
5
6
7
8
9
10
-- Load new orders for product 42 continuously into a table
-- order_id is an ever-increasing sequence allotted to each new order
CREATEEXTERNALTABLEexample.ext_order_product42REMOTEQUERY'SELECT * FROM example.orders WHERE product_id = 42'WITHOPTIONS(DATASOURCE='example.jdbc_ds',SUBSCRIBE=TRUE,REMOTE_QUERY_INCREASING_COLUMN='order_id')