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 out SQLLab views out of table list view by default #4746

Merged
merged 3 commits into from
Apr 12, 2018

Conversation

mistercrunch
Copy link
Member

This adds a is_sqllab_view flag in the "tables" table, and makes the
filters those out in the Tables list view.

The filter showing on top may be a bit confusing, but certainly less
than seeing lots of user generated views.

It fixes this:
screen shot 2018-04-03 at 10 15 10 am

The default link to "Tables" is a bit confusing as we show the filter by default. I tried other options like using FAB's base_filters but it prevents the SQL Lab view from being edited / visible in any way.
screen shot 2018-04-03 at 10 02 54 am

@codecov-io
Copy link

codecov-io commented Apr 3, 2018

Codecov Report

Merging #4746 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4746      +/-   ##
==========================================
+ Coverage   72.64%   72.66%   +0.01%     
==========================================
  Files         205      205              
  Lines       15402    15413      +11     
  Branches     1183     1183              
==========================================
+ Hits        11189    11200      +11     
  Misses       4210     4210              
  Partials        3        3
Impacted Files Coverage Δ
superset/connectors/connector_registry.py 89.74% <100%> (+0.85%) ⬆️
superset/views/core.py 74.47% <100%> (+0.01%) ⬆️
superset/connectors/sqla/models.py 77.22% <100%> (+0.14%) ⬆️
superset/connectors/sqla/views.py 71.84% <100%> (+0.27%) ⬆️
.../assets/javascripts/addSlice/AddSliceContainer.jsx 89.28% <100%> (+0.39%) ⬆️
superset/connectors/base/models.py 91.11% <100%> (+0.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee15fc8...1faa31f. Read the comment docs.

@@ -213,8 +216,10 @@ class TableModelView(DatasourceModelView, DeleteMixin, YamlExportMixin): # noqa
"Whether to populate the filter's dropdown in the explore "
"view's filter section with a list of distinct values fetched "
'from the backend on the fly'),
'is_sqllab_view': _(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anyway to infer this rather than it be a form option?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could remove it from the edit_columns and have it only in the show_columns if you think it's better

# Use Slice class defined here instead of models.Slice
for tbl in session.query(Table).all():
if tbl.sql:
tbl.is_sqllab_view = True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the presence of custom SQL doesn't always imply that the SQL corresponds to a SQL Lab view.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I'm not sure how else to identify it. It's the best proxy we have. Note that this does not change any behavior other than being filtered out by default in the Table list view, but the filter can be removed anyways, so I didn't think it had to be perfect. Goal here is just to hide some of the clutter this creates.

if tbl.sql:
tbl.is_sqllab_view = True
session.merge(tbl)
session.commit()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the session.commit() could be defined outside the for loop.

This adds a `is_sqllab_view` flag in the "tables" table, and makes the
filters those out in the Tables list view.

The filter showing on top may be a bit confusing, but certainly less
than seeing lots of user generated views.
@mistercrunch
Copy link
Member Author

Addressed comments, mergin

@mistercrunch mistercrunch merged commit b043590 into apache:master Apr 12, 2018
@mistercrunch mistercrunch deleted the flag_vizflow branch April 12, 2018 20:52
michellethomas pushed a commit to michellethomas/panoramix that referenced this pull request May 24, 2018
…4746)

* Filtering out SQLLab views out of table list view by default

This adds a `is_sqllab_view` flag in the "tables" table, and makes the
filters those out in the Tables list view.

The filter showing on top may be a bit confusing, but certainly less
than seeing lots of user generated views.

* flake

* Addressing comments
timifasubaa pushed a commit to timifasubaa/incubator-superset that referenced this pull request May 31, 2018
…4746)

* Filtering out SQLLab views out of table list view by default

This adds a `is_sqllab_view` flag in the "tables" table, and makes the
filters those out in the Tables list view.

The filter showing on top may be a bit confusing, but certainly less
than seeing lots of user generated views.

* flake

* Addressing comments
@john-bodley
Copy link
Member

@mistercrunch I think this change should be added to UPDATING.md.

wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
…4746)

* Filtering out SQLLab views out of table list view by default

This adds a `is_sqllab_view` flag in the "tables" table, and makes the
filters those out in the Tables list view.

The filter showing on top may be a bit confusing, but certainly less
than seeing lots of user generated views.

* flake

* Addressing comments
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.25.0 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.25.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants