From: | Chapman Flack <chap(at)anastigmatix(dot)net> |
---|---|
To: | pljava-dev(at)lists(dot)postgresql(dot)org |
Subject: | Re: Detecting test failures reported as warnings |
Date: | 2020-07-08 21:37:10 |
Message-ID: | 5F063C86.3070301@anastigmatix.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pljava-dev |
On 06/17/20 15:31, Chapman Flack wrote:
> I was looking at the various Python driver choices myself the other night
> and it wasn't as promising as I thought. pg8000 was the pure-Python one
> that I remembered, but can't access warnings (as far as I can tell).
For the record, so no future reader of this thread is misinformed, I was
wrong about that. pg8000 does make notices/warnings available, using the
'notices' property of a pg8000 Connection. It is a deque that will hold
the most recent not-more-than-100 that were received. popleft() will
retrieve them in arrival order.
Each item is a dict that presents all of the fields of the PostgreSQL
notice, keyed by their single-character codes:
/docs/9.6/protocol-error-fields.html
So, not only was I mistaken to say "can't access", it in fact provides
better access than many other PG drivers.
Errors are a bit botched: those raise exceptions of course, and the
exception will have a tuple of values. Those are the values of all
the fields received from PostgreSQL, just as in the warning case, but
with all the keys thrown away, leaving you to guess which field is which.
-Chap
From | Date | Subject | |
---|---|---|---|
Next Message | Kartik Ohri | 2020-07-09 10:48:25 | Re: PL/Java new build plugin |
Previous Message | Chapman Flack | 2020-07-07 22:42:45 | Re: PL/Java new build plugin |