Data Import, Export and Cleanup Tool
The data import and export utility allows to create new catalog, schemas, tables and entities as well as export them.
Import
To import data you need to provide a configuration that specifies the content to be created, Ermrest API Url and AuthCookie. This could be declared like this
var configuration = setup : "catalog": //"id": 1 //existing id of a catalog "schema": "name": "product" "createNew": true // change this to false to avoid creating new schema "path": "schema/product.json" // path of the schema json file in the current working directory folder "tables": "createNew": true // Mention this to be true to allow creating new tables "entities": "createNew": true // Mention this to be true to allow creating new entities "path": "data/product" // This is the path from where the json for the entities will be picked for import url: "https://dev.isrd.isi.edu/ermrest" //Ermrest API url authCookie: "ermrest_cookie;" // Ermrest Authentication cookie to create data cleanup: true
Once you've your configuration you just need to call the importData
function in your script. Here's how your code would look like if you have already declared the configuration variable mentioned above.
var ermrestUtils = ;ermrestUtils;
Cleanup
To delete the stuff created by the testcases, you should call tear
with the same configuration that you provided for import. This will delete only that data which was created by the import function and levae other stuff intact. To allow delete, you need to set cleanup as true in your configuration as mentioned above.
var ermrestUtils = ;ermrestUtils;
Export
To export an existing catalog and its default schema you can use the download
function. It will download the schema information and entities and save it in the folder that you provide.
var ermrestUtils = ;ermrestUtils;