From: | Hans Ginzel <hans(at)matfyz(dot)cz> |
---|---|
To: | Sebastiaan Mannem <sebastiaan(dot)mannem(at)enterprisedb(dot)com> |
Cc: | psycopg(at)postgresql(dot)org |
Subject: | Re: connect using env. variables |
Date: | 2021-03-09 11:06:19 |
Message-ID: | 20210309110619.GO11758@artax.karlin.mff.cuni.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
Empty string does not work for **parse_dsn(), see example below.
H.
On Tue, Mar 09, 2021 at 11:47:42AM +0100, Sebastiaan Mannem wrote:
>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 <hans(at)matfyz(dot)cz> wrote:
>
>> Please, there should be a possibility to call connect() without parameters
>> for connecting using environment variables (PGSERVICE, PGDATABASE,…)
>> or defaults ($USER(at)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
>>
>>
>>
From | Date | Subject | |
---|---|---|---|
Next Message | Daniele Varrazzo | 2021-03-09 11:44:27 | Re: connect using env. variables |
Previous Message | Sebastiaan Mannem | 2021-03-09 10:47:42 | Re: connect using env. variables |