-
-
Notifications
You must be signed in to change notification settings - Fork 690
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
?_nocol= does not interact well with default facets #1345
Comments
Related issue: visit https://latest.datasette.io/fixtures/facetable?_facet=state and click "Hide this column" on the "state" cog menu and you get https://latest.datasette.io/fixtures/facetable?_facet=state&_nocol=state which shows an error:
|
Two options here:
I think I like the first option more. I could partially implement that in the Instead the JavaScript should look for evidence in the DOM that specific facets are enabled. This could also help me cover other types of faceting, such as |
Maybe there's a concept here of the columns that are required by a selected facet? Those can then be included as I can also use them to provide a better error message than "no such column: state" - I can verify that There is one other option here: I could still include the columns that are known to be needed for faceting in the faceting SQL queries, but leave them out of the query that is used to return the results! That's actually a pretty tempting (albeit more complex) option. |
Maybe there's a short-term and longer-term solution for this - where the long-term solution is to use different columns in the faceting selects, while the short-term solution is to disable "Hide this column" for certain things. |
That long-term solution may not be too difficult. The facets are calculated against datasette/datasette/views/table.py Lines 659 to 665 in 7b106e1
And used here: datasette/datasette/views/table.py Lines 706 to 718 in 7b106e1
Crucially, |
Yes! This was easier than I thought. I'm going with that solution - where facets are calculated against all columns, ignoring |
Demo: https://latest.datasette.io/fixtures/facetable?_facet=state&_nocol=state - the state column is not selected but facet by state still works: |
Clicking "Hide this column" on
fips
on https://covid-19.datasettes.com/covid/ny_times_us_counties shows this error:https://covid-19.datasettes.com/covid/ny_times_us_counties?_nocol=fips
The reason is that https://covid-19.datasettes.com/-/metadata sets up the following:
It's setting
fips
as a default facet, which breaks if you attempt to remove the column using?_nocol
.The text was updated successfully, but these errors were encountered: