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 <h...@matfyz.cz> 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
>
>
>

Reply via email to