You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Accessing Row object by attribute fails. This works in pyodbc.
What steps will reproduce the problem?
1. Run a select query
2. Try accessing row object by column name
3. AttributeError will be thrown
E.g.
for row in cursor.fetchall():
id = row.id # <<<< fails
What is the expected output? What do you see instead?
I expect the value of the column to be return, instead I get an attributeerror
What version of the product are you using? On what operating system?
0.9.3
Please provide any additional information below.
Original issue reported on code.google.com by johnjian...@gmail.com on 13 Feb 2013 at 4:54
The text was updated successfully, but these errors were encountered:
You can change one line to enable it:
In the method Cursor.__init__() from:
self.row_type_callable = row_type_callable or TupleRow
To:
self.row_type_callable = row_type_callable or NamedTupleRow
After some consideration and testing, I tend to not enable that feature by
default, which is not in DBI 2.0 standard, and also only ascii attribute will
success:
for row in cursor.fetchall():
id = row.号码 # <<<< fails, field name must be ascii attributes
Original comment by jiangwen...@gmail.com on 24 Mar 2013 at 11:42
Original issue reported on code.google.com by
johnjian...@gmail.com
on 13 Feb 2013 at 4:54The text was updated successfully, but these errors were encountered: