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

Datatables won't render for Query CSVs for non "Select *" queries #4152

Open
jqnatividad opened this issue Mar 27, 2018 · 1 comment
Open
Assignees

Comments

@jqnatividad
Copy link
Contributor

jqnatividad commented Mar 27, 2018

CKAN Version if known (or site URL)

This is for https://github.com/ckan/ckan/tree/3816-query-based-views

Please describe the expected behaviour

For Stored Queries using explicitly declared result columns (not "select *" - see #4148 ), a data publisher can add a Datatables resource view without issue.

Please describe the actual behaviour

You get an error - "DataTables warning: table id=dtprv - Ajax error. For more information about this error, please see http://datatables.net/tn/7"

It appears datatables is expecting an "_ID" column. Perhaps, let datatables generate it?

What steps can be taken to reproduce the issue?

Create a Stored Query not using "select *", e.g.

select "MAIL_ZIPCODE", count(*),  sum( cast( "GROSS_TAX" as int)) as "SUMGROSS" from "e37aeb54-c17f-4a70-a502-fc7cce474812" group by "MAIL_ZIPCODE" order by "SUMGROSS" desc, "MAIL_ZIPCODE" asc limit 15

and then try to create a Datatables Resource View

@jqnatividad jqnatividad changed the title Datatables won't render for Query CSVs Datatables won't render for Query CSVs for non "Select *" queries Mar 27, 2018
@wardi wardi self-assigned this Mar 29, 2018
@jqnatividad
Copy link
Contributor Author

A workaround for this with Query CSVs is to use the row_number() window function to create a computed column when defining the select statement:

select row_number() over() as "_id",...

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

No branches or pull requests

2 participants