Import data into crateDB table from multiple json files

Hello CrateDB community,

I need help importing data into an existent crateDB database from multiple json files.
I’m currently using k8s with 8 pods of crateDB on docker containers and each pod has a list of json files under this path: /data/tmp/

sessions_0_04732dhm6kpjcc1g60o30c1g.json
sessions_0_04732dhm6sojed1k60o30c1g.json
sessions_0_04732dhm70pjgd1g60o30c1g.json
sessions_0_04732dhm74qjicpm60o30c1g.json
sessions_12_04732dhm68sj8c1o60o30c1g.json
sessions_12_04732dhm6grjad9i60o30c1g.json
sessions_12_04732dhm6kpjcc1g60o30c1g.json
sessions_12_04732dhn6cs34dpi60o30c1g.json
sessions_13_04732dhm68sj8c1o60o30c1g.json
sessions_13_04732dhm6ksjcd1o60o30c1g.json
sessions_13_04732dhn60s30cpi60o30c1g.json
sessions_13_04732dhn64q30e1g60o30c1g.json
sessions_14_04732dhm68sj8c1o60o30c1g.json

is there any way to import data in a loop without having to insert them file by file.

Any help is appreciate it.
Thanks

1 Like

COPY FROM allows URI globbing:

i.e. something like

COPY quotes FROM 'file:///tmp/sessions*.json';

should work.

1 Like

It’s working.
Thanks @proddata

2 Likes