You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pg_params= {
'database': 'solo',
'user': 'solo',
'password': 'solo',
'host': 'localhost',
'port': 5432
}
conn=psycopg2.connect(**pg_params)
# Result for psycopg2# "user=solo password=xxx dbname=solo host=localhost port=5432"# Result for psycopg2cffi# "dbname=solo user=solo password=solo host=localhost port=5432"print(conn.dsn)
It is not a big issue by itself, yet it complicates testing of projects that might benefit from being able to supportpsycopg2cffi as a drop-in replacement for psycopg2, for instance, aiopg2 (I'm currently working on this support in aio-libs/aiopg#361).
Hi!
It seems that there is a small difference in a way how
psycopg2cffi
andpsycopg2
print connection DSNs. The former does not obfuscate passwords, and the latter does (http://initd.org/psycopg/docs/connection.html#connection.dsn).It is not a big issue by itself, yet it complicates testing of projects that might benefit from being able to support
psycopg2cffi
as a drop-in replacement forpsycopg2
, for instance,aiopg2
(I'm currently working on this support in aio-libs/aiopg#361).Here's how psycopg2 obfuscates passwords:
https://github.com/psycopg/psycopg2/blob/a7e3f46431a85d9d0fd2f1a1a1908867bcc60881/psycopg/connection_type.c#L1252
https://github.com/psycopg/psycopg2/blob/a7e3f46431a85d9d0fd2f1a1a1908867bcc60881/psycopg/connection_type.c#L1342
P.S. It would be great if we could preserve the order of connection attributes as well
The text was updated successfully, but these errors were encountered: