Connect to an URI in postgres

后端 未结 2 1592
北荒
北荒 2021-02-03 18:20

I\'m guessing this is a pretty basic question, but I can\'t figure out why:

import psycopg2
psycopg2.connect(\"postgresql://postgres:postgres@localhost/postgres\         


        
2条回答
  •  醉话见心
    2021-02-03 18:34

    The connection string passed to psycopg2.connect is not parsed by psycopg2: it is passed verbatim to libpq. Support for connection URIs was added in PostgreSQL 9.2.

提交回复
热议问题