PSQLQueryTool Glossary

From DavinciWiki
(Difference between revisions)
Jump to: navigation, search
(layout procedure contents)
(working on procedure)
Line 21: Line 21:
 
}}
 
}}
 
{{DavinciWiki_FunctionBox|Procedure|
 
{{DavinciWiki_FunctionBox|Procedure|
* Use the following commands and set up in each of the following examples
+
* Use the following commands in each of the following examples
(1) Write the query; (2) access the PSQLQueryTool from Davinci; (3) read in the results (two options)
+
# Write the query; for more information see [[Writing_PSQL_DB_Queries|Writing PSQL-DB Queries]]
  dv>query="..."
+
# Access the PSQLQueryTool from Davinci; see the function page for a complete description of all available options
  ... dv-results
+
# Read in the results using one of the two options shown here:
 +
#: "read_lines" is better for queries that return fewer lines
 +
#: "copy" is better for queries that return hundreds of lines or verbose fields
 +
  dv>query="select table_name, field_name, description from glossary where schema_name='thmpub' order by table_name, field_name;"
 +
 
 
  dv>url=themis3db(query,psql=1,header=1)
 
  dv>url=themis3db(query,psql=1,header=1)
   ... dv-results
+
   Using PSQL password from: /themis/lib/dav_lib/dbpass/THM_DB_USER_davinci
  dv>gloss=read_lines("...")
+
  Read TEXT file: 1 lines
   ... dv-results
+
  make this a link! http...
 +
 
 +
  dv>gloss=read_lines(url)
 +
   Downloading.done.
 +
  Read TEXT file: 0 lines
 +
  Text Buffer with 0 lines of text
 
  --OR--
 
  --OR--
  dv>copy("...",$TMPDIR)
+
  dv>copy(url,$TMPDIR)
... dv-results
+
  Downloading.done.
 +
  [path to file repeated to screen]
  
 
* Example-1: Get a list of available tables
 
* Example-1: Get a list of available tables
Line 47: Line 57:
 
<div style="border:0; margin:0.2em; margin-top:-.8em" valign="top">
 
<div style="border:0; margin:0.2em; margin-top:-.8em" valign="top">
 
{{DavinciWiki_MiniNavBar}}
 
{{DavinciWiki_MiniNavBar}}
{{DavinciWiki_FunctionIfBox|Functions Used|{{{3}}}}}
+
{{DavinciWiki_FunctionIfBox|Functions Used|
{{DavinciWiki_FunctionIfBox|Related Procedures|{{{4}}}}}
+
* [[copy]]
 +
* [[read_lines]]
 +
* [[themis3db]]
 +
}}
 +
{{DavinciWiki_FunctionIfBox|Related Procedures|
 +
* [[Writing_PSQL_DB_Queries|Writing PSQL-DB Queries]]
 +
}}
 
</div></div>
 
</div></div>
 
|}
 
|}
 +
[[category:Procedures]]
 +
[[category:THEMIS_Science]]

Revision as of 10:36, 8 April 2014

Contents: Description, Procedure

Description

In order to make the most of the MSFF PSQL Mars database, you must be familiar with the schema and table layout of the database. The examples, provided here allow you to access the descriptions of the tables and columns available for you to use in your queries.

There are two sources for this information in the reference schema:

  1. reference.pubmars_glossary
    This is a VIEW based on joining several of the postgres control tables which define the actual Mars data tables; this includes tables in the public schema. Field descriptions will be null, if the table author did not populate a descriptive comment about the column.
    Suggested selection-list fields: schema_name, table_name, column_name, datatype_name, description
  2. reference.glossary
    This is a hand-updated table describing all of the tables under the control of THEMIS Mission-Operations; the descriptions provided here may be more verbose than those in the pubmars_glossary
    Suggested selection-list fields: table_name, field_name, value_type, description
    Suggested constraints: schema_name='thmpub'

The examples provided below are intended to get you started; however, you should refine the constraints-list and the order-by-list according to your needs.

Procedure

  • Use the following commands in each of the following examples
  1. Write the query; for more information see Writing PSQL-DB Queries
  2. Access the PSQLQueryTool from Davinci; see the function page for a complete description of all available options
  3. Read in the results using one of the two options shown here:
    "read_lines" is better for queries that return fewer lines
    "copy" is better for queries that return hundreds of lines or verbose fields
dv>query="select table_name, field_name, description from glossary where schema_name='thmpub' order by table_name, field_name;"
dv>url=themis3db(query,psql=1,header=1)
 Using PSQL password from: /themis/lib/dav_lib/dbpass/THM_DB_USER_davinci
 Read TEXT file: 1 lines
 make this a link! http...
dv>gloss=read_lines(url)
 Downloading.done.
 Read TEXT file: 0 lines
 Text Buffer with 0 lines of text
--OR--
dv>copy(url,$TMPDIR)
 Downloading.done.
 [path to file repeated to screen] 
  • Example-1: Get a list of available tables
dv> commands here
dv results ...
  • Example-2: Explore the columns available in a single table
dv> commands here
dv results ... 
  • Example-3: Search for available columns related to the concept of "temperature"
dv> commands here
dv results ... 

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Functions Used

Related Procedures

Personal tools