with ConnectionPool(
conninfo = app.config["POSTGRESQL_DATABASE_URI"],
max_size = app.config["DB_MAX_CONNECTIONS"],
kwargs = connection_kwargs,
) as pool:
With a connection string of postgresql://username:password@ipaddress:5432/database
, I get the error:
WARNING error connecting in 'pool-1': [Errno -2] Name or service not known
I can connect to it from psql
CLI with exactly the same parameters without any problem.
Note that the password contains special characters such as @
and $
with ConnectionPool(
conninfo = app.config["POSTGRESQL_DATABASE_URI"],
max_size = app.config["DB_MAX_CONNECTIONS"],
kwargs = connection_kwargs,
) as pool:
With a connection string of postgresql://username:password@ipaddress:5432/database
, I get the error:
WARNING error connecting in 'pool-1': [Errno -2] Name or service not known
I can connect to it from psql
CLI with exactly the same parameters without any problem.
Note that the password contains special characters such as @
and $
- This question is similar to: How to handle special characters in the password of a Postgresql URL connection string?. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. – snakecharmerb Commented Mar 18 at 7:07
1 Answer
Reset to default 0from urllib import parse
parse.quote("the password which contains special characters")