metabase icon indicating copy to clipboard operation
metabase copied to clipboard

Hiding a table makes it impossible to edit existing questions that uses that table

Open flamber opened this issue 4 years ago • 9 comments

Describe the bug When questions have been built on tables, which are hidden later, then it's either impossible to edit the question or the question will drop all references to the hidden table.

Possible workaround: Change the table name in Admin > Data Model by prepending ~DEPRECATED or similar, so the table is added to the end of tables.

To Reproduce

  1. Custom question > Sample Dataset > create a question like this and save as "Q1": image
  2. Admin > Data Model > Sample Dataset > hide Orders table - refresh browser and view "Q1" It's now not possible to edit the question at all - almost looks like a user without data access image
  3. Admin > Data Model > Sample Dataset > show Orders, but hide Products table - refresh browser and view "Q1" It's possible to edit the question, but making any changes will drop all references to Products table image

Expected behavior This issue might not be straight forward, since it should probably allow existing questions to keep working, but should not include all hidden tables in the API response by default, since that could introduce a performance issue on instances, where perhaps 1k tables have been hidden for technical reasons, because it's not possible to limit via the db privileges. A possible solution would be to introduce a "Deprecated" along with "Technical" and "Cruft", which would then include those tables in the API.

Information about your Metabase Installation: Tested 0.37.8 thru 0.39.1

Related to #6445 and #6298

flamber avatar May 06 '21 12:05 flamber

Should Metabase show a warning or prevent marking a table hidden if it is used in a question?

likeshumidity avatar Aug 25 '23 21:08 likeshumidity

Another possibility would be: once a table is hidden still let the query be shown even if you don't allow editing of it. Or, even more minor, at least let the user know why they can't edit the query. I lost a bunch of cycles on this issue so 👍 to getting it fixed.

keithschacht avatar Sep 29 '23 13:09 keithschacht

@krschacht upvote the original post. We look at the number of those upvotes. Upvote in a comment will get lost.

nemanjaglumac avatar Sep 29 '23 18:09 nemanjaglumac

@nemanjaglumac I don't see an option to upvote anywhere on this issues page. Maybe that's only for people who are part of the Metabase organization?

keithschacht avatar Sep 29 '23 18:09 keithschacht

@krschacht the left bottom of the first post image

nemanjaglumac avatar Sep 29 '23 18:09 nemanjaglumac

Still able to reproduce this on latest master at d35c779976ae6bd79369e9cc6bec8540908f37d2 The existing E2E reproductions seems to be valid.

Please note that converting a question into a model shows "Filter" and "Summarize", and converting it back to the saved question again removes them.

nemanjaglumac avatar Nov 08 '23 09:11 nemanjaglumac

I think this should remain with the QC team and be triaged by them. There's only a couple of basic conversions of the visibility_state fields on tables or fields in MLv2; I think the logic for eg. not allowing editing of a question based on a hidden table belongs to the FE components.

bshepherdson avatar Feb 15 '24 21:02 bshepherdson

Reproducible in master at 78cb28816a.

If the fix is to disallow editing queries referencing hidden tables, then it's QC area. I'll change label from BE to FE.

kamilmielnik avatar Mar 07 '24 11:03 kamilmielnik

The issue with hidden joined tables is the same as https://github.com/metabase/metabase/issues/37753 and https://github.com/metabase/metabase/issues/37751 and will be fixed by making the query readonly in such cases.

As for the main issue here, if you hide your source table, you won’t be able to edit the query in the query builder. Is it even a bug? Currently hiding a table makes it invisible in the entire app everywhere except Admin.

ranquild avatar Jun 28 '24 20:06 ranquild