-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
feat: add denylist for db engines #21486
feat: add denylist for db engines #21486
Conversation
23b44d9
to
1e932ff
Compare
Codecov Report
@@ Coverage Diff @@
## master #21486 +/- ##
==========================================
+ Coverage 55.46% 65.28% +9.81%
==========================================
Files 1800 1792 -8
Lines 68940 68671 -269
Branches 7334 7320 -14
==========================================
+ Hits 38236 44830 +6594
+ Misses 28812 21951 -6861
+ Partials 1892 1890 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
ad1a4e9
to
b29799f
Compare
if ( | ||
engine_spec.engine in dbs_denylist_engines | ||
and hasattr(engine_spec, "default_driver") | ||
and engine_spec.default_driver in dbs_denylist[engine_spec.engine] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, why just checking if the default_driver
is in the list and not any other that engine might have?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's just a way to identify the db_engine_spec so that the default driver option doesn't show up in the database connection list.
if request and hasattr(request, "param"): | ||
for key, val in request.param.items(): | ||
app.config[key] = val | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@betodealmeida I extended this method so that you can pass in extra configs from tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I like the idea!
Should we give this a more descriptive name, just in case? Eg, override_app_config
instead of param
?
Also, how is this used? Is request
a Flask request object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added typing here. Request is a pytest fixture sub request object. So I can’t change the name of param but agree it would read better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, I just left a couple comments!
if request and hasattr(request, "param"): | ||
for key, val in request.param.items(): | ||
app.config[key] = val | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I like the idea!
Should we give this a more descriptive name, just in case? Eg, override_app_config
instead of param
?
Also, how is this used? Is request
a Flask request object?
40d08b6
to
2b9c704
Compare
SUMMARY
Some db_engine_specs can have multiple db_engine_specs, Databricks for example. Since we build the database connection form available dbs dropdown list based on db_engine_specs that match installed drivers, there are times when one may not want to show all options. This is a simple optional denylist config that removes extra db engines from that list.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
With this code and no extra config added (this is what it looks like without this code):
Additional drivers installed:
databricks-sql-connector 2.0.2
sqlalchemy-databricks 0.2.0
With added local superset_config of:
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION