For starters, here’s a basic example using a JSON file system pipeline into a stored procedure:
MySQL [db]> create table t(a int, b text);
Query OK, 0 rows affected (0.05 sec)
MySQL [db]> delimiter //
MySQL [db]> create procedure json_ident(data_from_pipeline query(p_a int, p_b text)) as
→ begin
→ insert into t select p_a, p_b from data_from_pipeline;
→ end //
Query OK, 1 row affected (0.22 sec)
MySQL [db]> delimiter ;
MySQL [db]> create pipeline json_sp_pipe as
→ load data fs “/tmp/json_example”
→ into procedure json_ident
→ format json (p_a ← a, p_b ← b);
Query OK, 0 rows affected (0.40 sec)
The DEFAULT option in the subvalue mapping clause is the recommended way to deal with minor schema differences among input records. If that doesn’t suffice, I’d be interested in hearing more details about your case.