Re: KeyError: self._index[x]

From: tango ward <tangoward15(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: KeyError: self._index[x]
Date: 2018-05-08 03:11:15
Message-ID: CAA6wQL+vkvVYLhHJ_zcq+w-cdJb78qwVB2KvQSxXz-T3FY0wag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sorry, accidentally pressed send.

cur_p = conn_pr(cursor_factory=psycopg2.extras.DictCursor)
cur_t = conn_t.cursor(cursor_factory=psycopg2.extras.DictCursor)

cur_t.execute("""
SELECT TRANSLATE(snumber, ' ', '')
FROM sprofile """)

# This will result in KeyError
for row in cur_t:
print row['snumber']

# This works fine
for row in cur_t:
print row[0]

Sorry again.

I would really appreciate any suggestions.

Thanks,
J

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2018-05-08 03:50:14 Re: KeyError: self._index[x]
Previous Message tango ward 2018-05-08 03:07:55 KeyError: self._index[x]