public inbox for [email protected]
help / color / mirror / Atom feedFrom: Hans Ginzel <[email protected]>
To: [email protected]
Subject: connect using env. variables
Date: Tue, 9 Mar 2021 11:45:30 +0100
Message-ID: <[email protected]> (raw)
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]
Subject: Re: connect using env. variables
In-Reply-To: <[email protected]>
* 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