Closed danielgafni closed 9 months ago
Try putting a \ in front of the ?
Yeah this can happen. Try this
https://docs.python.org/3/library/urllib.parse.html?highlight=quote#urllib.parse.quote_plus
Thanks for the workarounds!
Seems like polars
should handle this internally tho?
I think manually escaping the pw is no future proof solution but using my linked method should work fine. Both ways are possible. One can say it's your job to create a valid connection string ;) But I agree, if polars does NOT do this it should be documented that the user has to do this and maybe give an easy example :)
Not all databases have the same connection string syntax and the focus is on making the queries work better rather than making connections string builders.
Once they make simple connection string builders then every option is fair game for someone to ask for.
Better to just leave it to the user or maybe a different library, maybe sqlalchemy can make a connection without doing anything else. I don't know.
@stinodego should this be closed or just turned into a feature request?
I'd like to phone a friend on this one. @alexander-beedie what's your take on this?
I'd like to phone a friend on this one. @alexander-beedie what's your take on this?
I think @deanm0000 is right; SQLAlchemy supports only itself - we support multiple engines/backends, and I agree that we don't want to get into the business of taking connection strings, parsing them, working out which specific rules apply for the given engine/backend combination, escaping accordingly, and then recombining them and handing off. The caller should know what is valid, and provide it in the correct form.
We should also probably assume that there are plenty of people already escaping their password correctly. If we now start applying quoting rules we will break them.
Clearly documenting that you are expected to supply a valid connection string "ready for use" when passed into the given engine is a good move, and I think that's sufficient 👍
Thanks Alex!
Right, so we'll accept a PR that improves the documentation on this, but we will not support it. I'll mark this as accepted.
This issue does not impact when using polars 0.18.11 with connectorx 0.3.2a7
Checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of Polars.
Reproducible example
Log output
Issue description
pl.read_database
started failing after the password inside the URI string got changed. It now contains a question mark symbol -?
.sqlalchemy
is able to use this string correctly, butpolars
fails to parse it.Expected behavior
Question marks should not break URI parsing
Installed versions