1.3.3. Web query interface

The web Query Interface Tool provides two basic features:

  • a way to browse the catalog tables, their schema, and their column descriptions
  • a way to query the tables and return the results to the browser (all users) or to your MyDB or virtual storage space (registered users only).

1.3.3.1. Browsing tables

When the Query Interface Tool is launched, you are presented with the following view, which shows a list of the survey datasets available through the Data Lab TAP service:

Clicking on a survey brings up a list of the tables contained within it. In the following view, we have clicked on smash_dr1, and are shown the eight tables available as part of the SMASH survey. (For basic information on the surveys and how their tables are organized, see the section on Survey Datasets).

If you hover over the tables with your mouse, you will get a popup that contains a short description of what that table contains. In the figure below, we have hovered over the smash_dr1.object table.

Clicking on a table name brings up a view of the columns that it contains, the column descriptions, and the data type of the column. Column names listed in bold are indexed in the database, while column names in normal type are not. For more on what indices do for you, see the section on Optimizing queries. The screen snap below shows the descriptions of the first 10 (alphabetically) of the 39 columns in smash_dr1.object.

1.3.3.2. Querying tables

Clicking on the Query Interface button allows you to make a query of one of the database tables by entering an ADQL statement in the text box. Below is the view you will see if you are an anonymous (not logged in) user. The Preview Limit column sets a limit on the number of rows that will be displayed in the browser, but does not place a limit on the query itself. You thus need to be careful with the number of rows that your query will return.

In the following, we have made a query of the smash_dr1.object table that will retrieve the ra, dec, gmag, rmag, and imag from the first 50 rows of the table from Field 169, and have hit the Process button. Note that the “TOP 50” statement in ADQL is equivalent to “LIMIT 50” in SQL.

The results are shown in the table below the query form, along with a table that shows the column descriptions. There are buttons to scroll through the columns as well as buttons to move through pages of rows. The results table can be filtered by applying arithmetic constraints in the text box above any of the columns and clicking Apply Filter (you can remove the filter with the Clear Filter button). You can change the order of the rows displayed by dragging the column names in the Column description table.

If you log in to the Data Lab, the Query Interface offers the option to store the results in Virtual Storage or as a table in MyDB. If you pick one of these options, you will be prompted to enter the name of the result, which will be a CSV file if saved to Virtual Storage or a table name if saved to MyDB. The result will also still be displayed to the browser, with the limit of the number of displayed rows set by the Preview Limit. The Storage Limit is applied to the query itself, and thus acts like a TOP (or LIMIT) statement in ADQL (SQL).

After clicking Process, the query is executed and the file (Virtual Storage) or table (MyDB) is created. A message to this effect will appear on the screen, along with the results shown in the browser. To access the Virtual Storage file or MyDB table you will need to use one of the other Data Lab clients, such as the datalab command.