Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

NOTE - this is a work in progress - this probably doesn't work!

Background

Opal has a python client that lets you query various things, and even import some data (see http://wiki.obiba.org/display/OPALDOC/Opal+Python+User+Guide). It doesn't let you create projects and tables from scratch though. Given the web interface does this via the REST API we should be able to do it from the command line. This is how.

First point to note is that we are still using the opal python client, we are just using the rest option of it - see http://wiki.obiba.org/display/OPALDOC/REST+API+Command

The following is loosely based on the AMASED work getting the BL books into opal - https://github.com/OllyButters/flatten-bl-xml

Test the python client

A good place to start is getting some info from the opal with the client:

...

The all_the_words.csv is the file you want to upload. The /home/administrator bit is where the file gets saved to - here it is assuming you are logged in as the administrator user and you want to save it in your home space, you could save it in the project space (I think). The CSV file itself should have a heading row for each of the columns that matches the variable names defined above.

Now to use the uploaded data:

Code Block
opal import-csv -o http://opal_address --user administrator --password password --destination my_project --table hamlet --path /home/administrator/all_the_words.csv --type Book

 Here we are telling opal where the CSV file is and which project/table to import it into.

Opal may take a few minutes to process all the data, it also will try to index it too. You can follow the process from the web interface.