Re: connect using env. variables

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Hans Ginzel <hans(at)matfyz(dot)cz>
Cc: Sebastiaan Mannem <sebastiaan(dot)mannem(at)enterprisedb(dot)com>, psycopg(at)postgresql(dot)org
Subject: Re: connect using env. variables
Date: 2021-03-09 14:02:03
Message-ID: CA+mi_8aEuy8bgegNVw40uaBg0skoQx=Fuiby+Strx09B2sO6ew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Tue, 9 Mar 2021 at 12:53, Hans Ginzel <hans(at)matfyz(dot)cz> wrote:
>
> Thank you.
>
> Is there a reason why connect() must get the empty string as parametr, please?

No, and I'm happy to make the dsn string optional, as you requested in
github. psycopg3 already works this way and you can use connect(). I
just wanted to point out that you can do what you want to do already:
connecting using only the PG* env var or the parse_dsn() produce.

It's one of these things that is ugly but has been that way for so
long that we are used to it. Or better, which should have been fixed
when we introduced the possibility to pass both the dsn string and the
keywords to connect(), because in the past there was no parse_dsn()
and facility to merge the two.

Cheers

-- Daniele

In response to

Browse psycopg by date

  From Date Subject
Next Message Daniele Varrazzo 2021-03-12 16:10:02 Connection pool branch merged in psycopg3
Previous Message Hans Ginzel 2021-03-09 11:53:16 Re: connect using env. variables