Versions Compared

Key

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

...

Check to see if the file has appeared in the archive:
$ ls /var/archive/data/blah.txt/
blah.txt

Note: Query commands do not depend on the underlying catalog implementation. The --sql and --lucene instead describe the filemgr query syntax.

At the time of writing this tutorial, composing queries using query_tool is not entirely straight forward, but entirely usable. Formatting of these queries is critical, small deviations from the syntax can result in the query return an unexpected value or throwing an exception.

Some things to note about SQL queries:

  1. Use double quotes ("") for when specifying the SQL syntax. The single quote ('') is used for string values in a WHERE clause, e.g WHERE Filename='blah.txt'
  2. Count the number of -- before each command line option. Some are -- and others are -.
  3. The order of the return values for a search is not guaranteed unless you specify the \outputFormat option.

Here is a somewhat verbose example that uses all the SQL-like syntax that I am currently aware of (apologies for all the line breaks).

No Format
nopaneltrue
$ cd /usr/local/oodt/cas-filemgr/bin
$ ./query_tool --url http://localhost:9000 --sql \
-query "SELECT CAS.ProductReceivedTime,CAS.ProductName,CAS.ProductId,ProductType,\
ProductStructure,Filename,FileLocation,MimeType \
FROM GenericFile WHERE Filename='blah.txt'" -sortBy 'CAS.ProductReceivedTime' \
-outputFormat '$CAS.ProductReceivedTime,$CAS.ProductName,$CAS.ProductId,$ProductType,\
$ProductStructure,$Filename,$FileLocation,$MimeType'

The output should look like:
2011-10-07T10:59:12.031+02:00,blah.txt,a00616c6-f0c2-11e0-baf4-65c684787732,
GenericFile,Flat,blah.txt,/var/kat/archive/data/blah.txt,text/plain

Now you can also check out some of the other 12 --operation possibilities for filemgr-client. For instance:

...