Skip to content

Commit

Permalink
docs(python): add a note to the read_database_uri docstring about e…
Browse files Browse the repository at this point in the history
…scaping special characters in the connection string (#13514)
  • Loading branch information
alexander-beedie committed Jan 7, 2024
1 parent cb86827 commit 1d46b1e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions py-polars/polars/io/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,10 @@ def read_database_uri(
* "postgresql://user:pass@server:port/database"
* "snowflake://user:pass@account/database/schema?warehouse=warehouse&role=role"
The caller is responsible for escaping any special characters in the string,
which will be passed "as-is" to the underlying engine (this is most often
required when coming across special characters in the password).
partition_on
The column on which to partition the result (connectorx).
partition_range
Expand Down Expand Up @@ -651,6 +655,15 @@ def read_database_uri(
For `adbc` you will need to have installed `pyarrow` and the ADBC driver associated
with the backend you are connecting to, eg: `adbc-driver-postgresql`.
If your password contains special characters, you will need to escape them.
This will usually require the use of a URL-escaping function, for example:
>>> from urllib.parse import quote, quote_plus
>>> quote_plus("pass word?")
'pass+word%3F'
>>> quote("pass word?")
'pass%20word%3F'
See Also
--------
read_database : Create a DataFrame from a SQL query using a connection object.
Expand Down

0 comments on commit 1d46b1e

Please sign in to comment.