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: return parameters only for DB with default driver #14803
Conversation
e77bc84
to
08b2762
Compare
available_databases.sort( | ||
key=lambda payload: preferred_databases.index(payload["engine"]) | ||
if payload["engine"] in preferred_databases | ||
else len(preferred_databases) |
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.
This was sorting the preferred DBs correctly, but doing a non-deterministic sort on the non-preferred. 🤦
Is SSL the only difference between the default and non default driver? Could we show them the form but not give them the option to turn on ssl (like we do for admins who enforce ssl but the opposite)? |
Right, but there could potentially be other parameters that are driver-dependent — maybe a MySQL driver uses client certificates instead of username/password — so I think we should only show the form if the default driver is installed. Also, if we show the form when the default driver is not installed, and the user has more than one non-default drivers installed, this raises the problem of which one we should use. Eg, the default driver for MySQL is I think users in cases like this probably know better, and so they can just the SQLAlchemy URI to configure the DB with a non-default driver. |
Codecov Report
@@ Coverage Diff @@
## master #14803 +/- ##
==========================================
- Coverage 77.38% 77.35% -0.04%
==========================================
Files 962 962
Lines 49174 49192 +18
Branches 6184 6184
==========================================
- Hits 38055 38051 -4
- Misses 10917 10939 +22
Partials 202 202
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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
* WIP * Fix sorting of DBs
* WIP * Fix sorting of DBs
* WIP * Fix sorting of DBs
SUMMARY
This PR improves the
/api/v1/database/available/
endpoint:mysqldb
andmysqlconnector
for MySQL, in my system).mysqldb
for MySQL).mysqldb
is not installed butmysqlconector
is, don't show the parameters for MySQL).The reason for (3) is that if the user doesn't have the default driver installed we can't enable SSL for them. For example, for MySQL the engine spec can only enable it for the default
mysqldb
driver (see).If the user wants to use the non-default driver they need to use the old method via the SQLAlchemy URI. In that case we don't show the
parameters
for the engine spec, so that the modal should only allow the DB to be configured via the URI.(1) and (2) will not be used by the modal, but are useful for debugging and troubleshooting.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TESTING INSTRUCTIONS
Updated unit tests.
Also tested manually. On my machine, with:
The response in
/api/v1/database/available/
is:ADDITIONAL INFORMATION