Command Line Query Tool for AKARI·CAS

sqlcl_akari.py is a simple Python program to get catalog data by SQL queries against DARTS/AKARI CAS or SDSS SkyServer. The original program (sqlcl.py) was written by Dr. Tamás Budavári of the SDSS project, and he gave us permission to modify/re-distribute his program.

Download
sqlcl_akari.py (3.6kB)
Requirements
Python version 2 series.

Command line examples/tutorial:

Use -h option to display help.

$ python sqlcl_akari.py -h
>> sqlcl << command line query tool by Tamas Budavari <budavari@jhu.edu>
Usage: sqlcl [options] sqlfile(s)

Options:
        -s url     : URL with the ASP/PHP interface
                     (SDSS default: pha, AKARI default: DARTS)
        -d db      : Database (AKARI only)
        -f fmt     : set output format (html,xml,csv - default: csv)
        -q query   : specify query on the command line
        -t         : show column types (AKARI only)
        -l         : skip first line of output with column names
        -v         : verbose mode dumps settings in header
        -h         : show this message

A simple query.

$ python sqlcl_akari.py -d DR1 -q "select ra,dec from fisobj limit 2"
ra,dec
314.544728970311,40.603661239902
314.547985208383,43.5163343974293

Of course, you can set your file having SQL command to argument.

$ python sqlcl_akari.py -d DR1 test.sql 

sqlcl_akari.py can be used against SDSS SkyServer. Make a symbolic link like this:

$ ln -s sqlcl_akari.py sqlcl.py
$ python sqlcl.py -v -q "select top 2 ra,dec from photoobj"
# SOURCE: http://cas.sdss.org/public/en/tools/search/x_sql.asp
# TIME: Sun Apr  5 18:42:54 2009
# QUERY:
#   select top 2 ra,dec from photoobj
ra,dec
50.70879784,76.96311771
50.79907066,77.07514445

See also SDSS sqlcl page.

Last Modified: 26 April 2011