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

[fix] cluster_name = cluster_name, not cluster_id #8514

Conversation

serenajiang
Copy link
Contributor

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

Found these 3-year-old bugs while looking into some other stuff. I'm guessing this may have happened because of some copy paste errors. It probably isn't too important since they haven't been caught, but it's pretty irksome to look at, so here we go.

TEST PLAN

Passes tox.

REVIEWERS

@john-bodley

Copy link
Contributor

@michellethomas michellethomas left a comment

Choose a reason for hiding this comment

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

Weird that they haven't caused issues given that it looks like it's being used in security.py, so you tested and it wasn't working but is now?

@codecov-io
Copy link

codecov-io commented Nov 6, 2019

Codecov Report

Merging #8514 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #8514   +/-   ##
=======================================
  Coverage   66.68%   66.68%           
=======================================
  Files         449      449           
  Lines       22684    22684           
  Branches     2366     2366           
=======================================
  Hits        15126    15126           
  Misses       7420     7420           
  Partials      138      138
Impacted Files Coverage Δ
superset/connectors/druid/models.py 82.43% <ø> (ø) ⬆️
superset/connectors/druid/views.py 69.12% <ø> (ø) ⬆️

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 571c474...aaa030f. Read the comment docs.

@@ -1612,7 +1612,7 @@ def query_datasources_by_name(
) -> List["DruidDatasource"]:
return (
session.query(cls)
.filter_by(cluster_name=database.id)
.filter_by(cluster_name=database.database_name)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@michellethomas
This didn't cause any problems for us because we use our own security manager, so this function isn't used.

I did a little more digging, and I'm not entirely certain that cluster_name=database.database_name is correct, since clusters != databases in our tables. Maybe this line should just be removed? Do you know anyone with more context on this kind of thing? Either way, this change won't cause any (more) problems, but it does seem wrong.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe @mistercrunch could chime in here? This code is pretty old

Copy link
Member

Choose a reason for hiding this comment

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

Mmmh, for reference, this came from #2497.

Clearly there are issues around the Connector interface. Good news is we're planning on deprecating the Druid connector in favor of SQLAlchemy

Copy link
Member

Choose a reason for hiding this comment

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

This new line is likely to fail as much as the previous line.

@serenajiang serenajiang deleted the serena-fix-cluster-name-id-mismatch branch January 10, 2020 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants