Re: Map connection().status() to name?

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>
Cc: "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org>
Subject: Re: Map connection().status() to name?
Date: 2016-11-18 23:34:54
Message-ID: CA+mi_8aAj9Af-UBLwuqnueX4xkx3KsSiLzDUvbw9Es_LHLDoBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Fri, Nov 18, 2016 at 8:47 PM, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com> wrote:
> On 11/11/16 2:14 PM, Jim Nasby wrote:
>>
>> I realize that there are constants in psycopg2.extensions for available
>> connection statuses and what-not, but is there any included way to map a
>> returned status to a descriptive string? When I'm trying to debug
>> something a status of '2' doesn't really tell me anything useful. :(
>
>
> Would a patch implementing such a map be accepted?

I don't see why not. What constant do you want to reverse? The groups
in `extensions` are status, isolation level, transaction status. Would
you provide 3 different functions to reverse them?

-- Daniele

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Jim Nasby 2016-11-19 00:29:58 Re: Map connection().status() to name?
Previous Message Jim Nasby 2016-11-18 20:47:17 Re: Map connection().status() to name?