RDH: Creating an SQL query from a DAP2 Constraint Expression: Difference between revisions
From OPeNDAP Documentation
⧼opendap2-jumptonavigation⧽
Line 6: | Line 6: | ||
== DAP Selection == | == DAP Selection == | ||
# Each clause should be converted (where possible) into a condition in the WHERE | # Each clause should be converted (where possible) into a condition in the [http://www.w3schools.com/sql/sql_where.asp SQL SELECT statements WHERE clause]. | ||
# Array sub-setting cannot be encoded in the SQL query and must happen once the row set response has been received. | # Array sub-setting cannot be encoded in the SQL query and must happen once the row set response has been received. | ||
Line 15: | Line 15: | ||
SELECT v, u FROM foo WHERE lat<26 AND lat>24 AND lon<-126 AND lon>-128 | SELECT v, u FROM foo WHERE lat<26 AND lat>24 AND lon<-126 AND lon>-128 | ||
Additionally we may wish to | Additionally we may wish to add: | ||
# The use of a limited regular expression type of matching in the CE which could be used to create [http://www.w3schools.com/sql/sql_like.asp SQL "LIKE" operators]. | # The use of a limited regular expression type of matching in the CE which could be used to create [http://www.w3schools.com/sql/sql_like.asp SQL "LIKE" operators]. | ||
# Some kind of a range operation that would map to [http://www.w3schools.com/sql/sql_between.asp SQL "BETWEEN" operator]. | # Some kind of a range operation that would map to [http://www.w3schools.com/sql/sql_between.asp SQL "BETWEEN" operator]. | ||
# A server side function that allows the user to specify that they only wish to receive ''unique'' (aka ''distinct'') values in the response. This would utilize the [http://www.w3schools.com/sql/sql_distinct.asp SQL "DISTINCT" operator]. |
Revision as of 17:18, 5 May 2009
DAP Projection
- Each projected variable should appear as selected columns in the SQL SELECT statement.
- The name of the Data Source (which is the DAP resource ID) should be used in the FROM section of the SELECT statement.
DAP Selection
- Each clause should be converted (where possible) into a condition in the SQL SELECT statements WHERE clause.
- Array sub-setting cannot be encoded in the SQL query and must happen once the row set response has been received.
For example, the request:
http://localhost/opendap/rdh/foo?v,u&lat<26&lat>24&lon<-126&lon>-128
would be converted in the SQL query:
SELECT v, u FROM foo WHERE lat<26 AND lat>24 AND lon<-126 AND lon>-128
Additionally we may wish to add:
- The use of a limited regular expression type of matching in the CE which could be used to create SQL "LIKE" operators.
- Some kind of a range operation that would map to SQL "BETWEEN" operator.
- A server side function that allows the user to specify that they only wish to receive unique (aka distinct) values in the response. This would utilize the SQL "DISTINCT" operator.