Re: iterating over DictRow

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>, psycopg(at)lists(dot)postgresql(dot)org
Subject: Re: iterating over DictRow
Date: 2020-09-25 23:46:39
Message-ID: e384427d-9d7f-a9e5-22cc-ab97ec9853ea@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On 9/25/20 3:25 PM, Karsten Hilbert wrote:
> On Fri, Sep 25, 2020 at 03:19:12PM -0700, Adrian Klaver wrote:
>
>>> Sure, there's a number of solutions to my immediate problem,
>>> the fitting of which is
>>>
>>> for key in dict(DictRow):
>>>
>>> That's the best fit because my
>>>
>>> def _escape_dict(the_dict, ...):
>>>
>>> was inaptly named. It should have been (and now is)
>>>
>>> def _escape_dict_like(dict_like, ...):
>>>
>>> within which
>>>
>>> dict(dict_like)
>>>
>>> is quite the thing to do despite having to make something a
>>> duck which already nearly quacks like one is somehwat
>>> unfortunate.
>>
>> I'm pretty sure DictRow has had the same behavior for some time so:
>>
>> Are you migrating from Python 2?
>
> I did not too long ago.

So that explains the error that popped up.

>
>> Or what changed that made this show up?
>
> At the very core ? My grandpa was admitted to a hospital :-)

Sorry to hear that, it's a trial.

>
> Karsten
> --
> GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse psycopg by date

  From Date Subject
Next Message Mark Charsley 2020-10-14 14:20:05 Possible data race in psycopg2
Previous Message Karsten Hilbert 2020-09-25 22:25:23 Re: iterating over DictRow