Re: KeyError: self._index[x] - Mailing list pgsql-general

From tango ward
Subject Re: KeyError: self._index[x]
Date
Msg-id CAA6wQL+vkvVYLhHJ_zcq+w-cdJb78qwVB2KvQSxXz-T3FY0wag@mail.gmail.com
Whole thread Raw
In response to KeyError: self._index[x]  (tango ward <tangoward15@gmail.com>)
Responses Re: KeyError: self._index[x]
Re: KeyError: self._index[x]
List 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

pgsql-general by date:

Previous
From: tango ward
Date:
Subject: KeyError: self._index[x]
Next
From: "David G. Johnston"
Date:
Subject: Re: KeyError: self._index[x]