LI3DS / cli-li3ds

CLI to interact with the LI³DS datastore through the LI³DS HTTP API
GNU General Public License v3.0
1 stars 0 forks source link

import-json #74

Closed mbredif closed 7 years ago

mbredif commented 7 years ago

This PR adds a new entrypoint to import json files that already follow the li3ds data model. The json structure must be a dictionary that maps object types to an array of JSON objects. The only specificity is that ids (both definitions and references) are for now local to the json file, so that li3ds objects with a imported json file may reference each other. These local ids are not preserved once the objects are imported in the database and neither can they reference ids of object that are already in the database.

{
"sensor": [ ... sensors... ],
"referential": [ ... referentials ...],
"transfos/type": [ ... transfo types ... ],
"transfo": [ ... transfos ... ],
"transfotree": [ ... transfo trees ... ],
"platform": [ ... platforms ... ],
"platforms/{id}/config": [ ... configs ... ],
"project": [ ... projects ... ],
"session": [ ... sessions ... ],
"datasource": [ ... datasources ... ]
}

The rationale of this PR is to enable to insert data within the li3ds database directly (ie without converting from any other datamodel).

elemoine commented 7 years ago

Also, it would be good to add a test file and have test.sh import it.

mbredif commented 7 years ago

I added import-json to test.sh and took into account minor comments. I am not sure what is the right thing to do for the encoding and isoformat remarks.