SDSS Command Line Query ToolAuthor: Tamas Budavari, JHUDate: April 2003, updated January 2005 (DR3) sqlcl.py is a (very) simple Python program that can run SQL queries against SkyServer. Python runs on your favourite OS including the most exotic ones. The query goes through the same .asp page that you use in the web form or using wget. March/04 Upgrades:
For basic SQL help, go to the Intro to SQL page
Command line examples/tutorial:skysrv: budavari$ sqlcl.py -h >> sqlcl << command line query tool by Tamas Budavari Python examples/tutorial:skysrv: budavari$ python2 Python 2.2 (#1, Apr 12 2002, 15:29:57) [GCC 2.96 20000731 (Red Hat Linux 7.2 2.96-109)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sqlcl >>> print sqlcl.query("select top 2 ra, dec from galaxy").read() ra,dec 238.594193,-5.39169E-1 238.588016,2.669783E-1 >>> lines = sqlcl.query("select top 2 ra, dec from galaxy").readlines() >>> data = [] >>> for line in lines[1:]: data.append(map(float,line[:-1].split(','))) ... >>> print data [[238.59419299999999, -0.53916900000000001], [238.58801600000001, 0.2669783]] >>> print data[0] [238.59419299999999, -0.53916900000000001] >>> print data[0][0] 238.594193 >>> print type(data[0][0]) This should be enough to get you started, let me know if you need more help!
|