Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering on EITI data "changed" column #219

Open
t-morrison opened this issue Mar 14, 2018 · 2 comments
Open

Filtering on EITI data "changed" column #219

t-morrison opened this issue Mar 14, 2018 · 2 comments

Comments

@t-morrison
Copy link
Member

Filtering does not work on the changed and created columns. Returns a js error.

See: https://www.resourcedata.org/dataset/eiti-complete-summary-table/resource/4e4462a5-6029-4ae3-a4cc-66ad6ccc6d70?filters=

image

@EricSoroos
Copy link
Collaborator

ValidationError: {'info': {'params': [()], 'statement': ['\\n            SELECT array_to_json(array_agg(j))::text FROM (\\n                SELECT  "_id" as "_id", to_json(to_char("created", \\'YYYY-MM-DD"T"HH24:MI:SS\\')) as "created", to_json(to_char("changed", \\'YYYY-MM-DD"T"HH24:MI:SS\\')) as "changed", "country" as "country", "iso3" as "iso3", "year" as "year", "start_date" as "start_date", "end_date" as "end_date", "government_agency_name" as "government_agency_name", "gfs_code" as "gfs_code", "gfs_description" as "gfs_description", "name_of_revenue_stream" as "name_of_revenue_stream", "currency_code" as "currency_code", "currency_rate" as "currency_rate", "value_reported" as "value_reported", "value_reported_as_USD" as "value_reported_as_USD", "reporting_url" as "reporting_url"\\n                FROM "ee6c62b8-1ccf-42e2-8df2-04d5daaa6ed8" \\n                 ORDER BY "changed" asc LIMIT 10 OFFSET 0\\n            ) AS j'], 'orig': ['could not identify an ordering operator for type json\\nLINE 5:                  ORDER BY "changed" asc LIMIT 10 OFFSET 0\\n                                  ^\\nHINT:  Use an explicit ordering operator or modify the query.\\n']}, 'query': ['Invalid query']},

selected stack entries:

ckan          | [Tue Jul 10 11:10:18.823897 2018] [:error] [pid 7142:tid 139994056292096] [client 127.0.0.1:43296] File '/usr/lib/ckan/default/src/ckan/ckanext/datatablesview/controller.py', line 50 in ajax, 
ckan          | [Tue Jul 10 11:10:18.824018 2018] [:error] [pid 7142:tid 139994056292096] [client 127.0.0.1:43296] File '/usr/lib/ckan/default/src/ckan/ckanext/datastore/logic/action.py', line 469 in datastore_search, 

@EricSoroos
Copy link
Collaborator

Core issue appears to be in the datastore, when returning json data it encodes specific fields as a json type to format them properly, but that json type is not sortable in the database. I think the problem here is that they're aliasing the name of the returned (formatted) column to the name of the underlying database column, and not qualifying or casting the sort. All of this is core ckan.

Looks like this is: ckan/ckan#4288 and will be in ckan 2.7.5. We should update when it's available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants