beautah opened a new issue #13062:
URL: https://github.com/apache/superset/issues/13062
I have a several mySQL databases with the naming convention:
`<user>$<device>`. When querying the connection seems to fail often, seemingly
with different behavior for different methods called. It was apparent from the
error message that the database name was being mutated to `<user>%24<device>`.
Its a simple enough fix to use the following mutator function in the
superset_config.py to fix this:
```
def DB_CONNECTION_MUTATOR(uri, params, username, security_manager, source):
uri.database = uri.database.replace('%24', '$')
return uri, params
```
But given "$" is a valid character in a mySQL database's name it seems to me
that this should work "out of the box" so to speak. Again, easy fix but seems
like a bug. Excellent choice to make the DB_CONNECTION_MUTATOR available in the
config, not sure if that's borrowed from another library, but its a slick way
to get the job done.
### Expected results
I expect the connection string to keep the name of the database correct,
even with a "$". Or conversely convert the url encoding back to the original
before passing it to sqlalchemy's create_engine
### Actual results
It's obviously converting to a url safe string, I'm guessing urllib.parse?
Any "$" gets converted to "%24"
#### Screenshots
None... the error had something to do with invalid credentials, but in
reality the database it was looking for doesn't exist
#### How to reproduce the bug
Create a database with a "$" in the name of the database, mySQL in
particular. Then try to connect in SQLab
### Environment
- superset version: `1.0`
- python version: `3.8`
- node.js version: `unknown`
### Checklist
- [x ] I have checked the superset logs for python stacktraces and included
it here as text if there are any.
- [x ] I have reproduced the issue with at least the latest released version
of superset.
- [x ] I have checked the issue tracker for the same issue and I haven't
found one similar.
### Additional context
This is no biggie, easily solved with a provided methodology (mutate the
connection), but given its a valid use case I wanted to make the devs aware.
Sorry no logs, they have since been deleted after I fixed and I'd rather not
revert just to get the exact error message/traceback.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]