Psycopg2: Cannot update column in a RealDictRow

Created on 10 Apr 2019  路  5Comments  路  Source: psycopg/psycopg2

File "/x/y/.pyenv/versions/3.6.6/envs/z/lib/python3.6/site-packages/psycopg2/extras.py", line 282, in __setitem__
    super(RealDictRow, self).__setitem__(mapping[key], value)
graphql.error.located_error.GraphQLLocatedError: list indices must be integers or slices, not str

Example code:

row[col] = some_function(row[col], some_param).decode('utf-8')

(where row is an instance of RealDictRow)

psycopg2-binary v2.8.1
https://github.com/psycopg/psycopg2/commit/cc815e8e8d33d5f39e602eebd6f7341952dfe058

All 5 comments

How was the row created?

It's probably more related to #884. Could you check if https://github.com/psycopg/psycopg2/commit/4058f363d69159b7c0193b6bd873aa0ee0621a89 fixes the problem?

Will do.

@dvarrazzo Yes, it does.

Cool, thank you: I'll try to release 2.8.2 with a fix in the next days.

Was this page helpful?
0 / 5 - 0 ratings