Describe the bug
The sqlalchemy.URL.render_as_string() method does not escape '%' signs, resulting in a broken URL that cannot be re-parsed by SQLAlchemy.
Optional link from https://docs.sqlalchemy.org which documents the behavior that is expected
No response
SQLAlchemy Version in Use
2.0.23
DBAPI (i.e. the database driver)
psycopg2
Database Vendor and Major Version
PostgreSQL 15
Python Version
3.10
Operating system
MacOS
To Reproduce
from sqlalchemy.engine import make_url
from sqlalchemy import URL
url = URL.create(drivername="postgres", username="a", password="a%7db", host="localhost")
recreated = make_url(url.render_as_string(hide_password=False))
assert url.password == recreated.password, f"{url.password} != {recreated.password}"
Error
Python 3.10.13 (main, Nov 6 2023, 23:53:04) [Clang 15.0.0 (clang-1500.0.40.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sqlalchemy.engine import make_url
>>> from sqlalchemy import URL
>>> url = URL.create(drivername="postgres", username="a", password="a%7db", host="localhost")
>>> recreated = make_url(url.render_as_string(hide_password=False))
>>> assert url.password == recreated.password, f"{url.password} != {recreated.password}"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AssertionError: a%7db != a}b
>>>
Additional context
No response
Describe the bug
The
sqlalchemy.URL.render_as_string()method does not escape '%' signs, resulting in a broken URL that cannot be re-parsed by SQLAlchemy.Optional link from https://docs.sqlalchemy.org which documents the behavior that is expected
No response
SQLAlchemy Version in Use
2.0.23
DBAPI (i.e. the database driver)
psycopg2
Database Vendor and Major Version
PostgreSQL 15
Python Version
3.10
Operating system
MacOS
To Reproduce
Error
Additional context
No response