The psycopg2 module content — Psycopg 2.9.3 documentation
www.psycopg.org › docs › moduleThe connection parameters can be specified as a libpq connection string using the dsn parameter: conn = psycopg2.connect("dbname=test user=postgres password=secret") or using a set of keyword arguments: conn = psycopg2.connect(dbname="test", user="postgres", password="secret") or using a mix of both: if the same parameter name is specified in both sources, the kwargs value will have precedence over the dsn value.