public inbox for [email protected]
help / color / mirror / Atom feedFrom: Sebastiaan Mannem <[email protected]>
To: Hans Ginzel <[email protected]>
Cc: [email protected]
Subject: Re: connect using env. variables
Date: Tue, 9 Mar 2021 11:47:42 +0100
Message-ID: <CAASsAGZCq2UOU_wmqO99kku5T3KwTOATi7NzdN_Zgk6mR-CWpA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
How about emptystring (e.a. '')?
Power to Postgres™!
Sebastiaan Mannem
Product Manager
M: +31 6 8252 1560
edbpostgres.com
EDB, Anthony Fokkerweg 1, 1059 CM Amsterdam, The Netherlands
On Tue, Mar 9, 2021 at 11:45 AM Hans Ginzel <[email protected]> wrote:
> Please, there should be a possibility to call connect() without parameters
> for connecting using environment variables (PGSERVICE, PGDATABASE,…)
> or defaults ($USER@localhost/postgres).
>
> Even pg uri postgres:// is valid,
> https://www.postgresql.org/docs/current/libpq-connect.html.
>
> >>> d = psycopg2.connect(**parse_dsn('postgres://'))
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 124,
> in connect
> raise TypeError('missing dsn and no parameters')
> TypeError: missing dsn and no parameters
> >>> d = psycopg2.connect(**parse_dsn(''))
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 124,
> in connect
> raise TypeError('missing dsn and no parameters')
> TypeError: missing dsn and no parameters
> >>> db = psycopg2.connect()
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 124,
> in connect
> raise TypeError('missing dsn and no parameters')
> TypeError: missing dsn and no parameters
>
> Thank you in advance,
> Hans
>
>
>
view thread (6+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: connect using env. variables
In-Reply-To: <CAASsAGZCq2UOU_wmqO99kku5T3KwTOATi7NzdN_Zgk6mR-CWpA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox