Once you properly construct a DataStore API SQL query using the appropriate quotes (see original description of the issue below) the API responds with an Authorization Error. For example, this query should work fine:
https://inventory.data.gov/api/action/datastore_search_sql?sql=SELECT * from "02c2b1c6-a42d-4a10-9e8b-9cf06e54a82b" WHERE "AWARD_YEAR" = '2014'
Updating name of this issue from "DataStore API SQL queries expect column names to be lowercase" to "DataStore API SQL queries respond with Authorization Error"
Originally the problem was thought to be simply an issue of capitalizing the column names, but that issue should be addressed by quoting the column names - this is another thing that could also be better articulated in the documentation and examples for the DataStore API.
Original description:
It looks like the way SQL queries are handled with the DataStore API expects all column names to be lowercase. If you specify an uppercase column name it won't find it (even if it exists) because it runs the query using a the column name as lowercase.
Here's an example:
https://inventory.data.gov/api/action/datastore_search_sql?sql=SELECT%20*%20from%20%2202c2b1c6-a42d-4a10-9e8b-9cf06e54a82b%22%20WHERE%20AWARD_YEAR%20LIKE%20%272014%27
This looks like it's specifically a problem for using the API with GET and the full SQL syntax. It's not a problem using POST and specifying the parameters as JSON in the body.
Once you properly construct a DataStore API SQL query using the appropriate quotes (see original description of the issue below) the API responds with an Authorization Error. For example, this query should work fine:
https://inventory.data.gov/api/action/datastore_search_sql?sql=SELECT * from "02c2b1c6-a42d-4a10-9e8b-9cf06e54a82b" WHERE "AWARD_YEAR" = '2014'
Updating name of this issue from "DataStore API SQL queries expect column names to be lowercase" to "DataStore API SQL queries respond with Authorization Error"
Originally the problem was thought to be simply an issue of capitalizing the column names, but that issue should be addressed by quoting the column names - this is another thing that could also be better articulated in the documentation and examples for the DataStore API.
Original description:
It looks like the way SQL queries are handled with the DataStore API expects all column names to be lowercase. If you specify an uppercase column name it won't find it (even if it exists) because it runs the query using a the column name as lowercase.
Here's an example:
https://inventory.data.gov/api/action/datastore_search_sql?sql=SELECT%20*%20from%20%2202c2b1c6-a42d-4a10-9e8b-9cf06e54a82b%22%20WHERE%20AWARD_YEAR%20LIKE%20%272014%27
This looks like it's specifically a problem for using the API with GET and the full SQL syntax. It's not a problem using POST and specifying the parameters as JSON in the body.