- changed status to duplicate
SQLALCHEMY_DATABASE_URI with psycopg2 wont work if password have '+'
Just tried to create URI connection string where user have password with '+' character, SQLAlchemy gives no clue in error and connecting to database using psql works fine. Example URI: SQLALCHEMY_DATABASE_URI = "postgresql+psycopg2://user:user+@somehosy.somedomain.com:5432/some_db"
Output: sqlalchemy.exc.OperationalError: (OperationalError) FATAL: password authentication failed for user "user" FATAL: password authentication failed for user "user" None None
Changing password to not having '+' works fine.
Comments (4)
-
repo owner -
repo owner see http://docs.sqlalchemy.org/en/rel_0_9/changelog/migration_09.html#the-password-portion-of-a-create-engine-no-longer-considers-the-sign-as-an-encoded-space . In 0.9, this script passes:
from sqlalchemy.engine import url for pw in ( "postgresql+psycopg2://user:user+@somehosy.somedomain.com:5432/some_db", "postgresql+psycopg2://user:user%2B@somehosy.somedomain.com:5432/some_db" ): u = url.make_url(pw) assert u.password == "user+", u.password
so in 0.8 for a workaround, use the %2B form.
-
reporter Ok thanks, I've resolved it by changing the password to other one.
-
repo owner - removed milestone
Removing milestone: 0.8.xx (automated comment)
- Log in to comment
Duplicate of
#2873.