Closed GoogleCodeExporter closed 8 years ago
[deleted comment]
# I confirm this problem.
# this is how I solve it now
# row=cur.fetchone()
# clean_dict(row)
#
def clean_dict(mydict):
"""clean a database row
remove numeric keys, keep the named keys
modifies original dict in place, be careful
"""
# remove numeric keys
for i in range(len(mydict)):
try:
del mydict[i]
except KeyError, e:
break
return mydict
Original comment by oetelaar.automatisering
on 19 Nov 2012 at 8:47
I committed a fix for this issue (with a test included):
http://code.google.com/p/pymssql/source/detail?r=08ae783880dd37ec4c7b5600e5815b4
9f167bbb2
Does this solve the problem for you guys and let you remove your workarounds?
Original comment by msabr...@gmail.com
on 10 Jan 2013 at 1:11
pymssql-2.0.0b1-dev-20130403.tar.gz at
https://code.google.com/p/pymssql/downloads/list has this change.
Can someone other than me confirm that it works?
Original comment by msabr...@gmail.com
on 3 Apr 2013 at 7:22
Fix looks good, I installed the latest version of pymssql
(pymssql_test)srujanv-mac:test srujanv$ pip freeze | grep pymssql
Warning: cannot find svn location for pymssql==2.0.0b1-dev-20130403
pymssql==2.0.0b1-dev-20130403
Executed the following query with 'as_dict=True'
Query:
SELECT [ID]
,[EmployeeID]
,[FirstName]
,[LastName]
,[JoiningDate]
,[AreaCode]
FROM [Employee]
Result-set returned
{'EmployeeID': 'E10021 ', 'FirstName': 'John', 'AreaCode': 'CA001 ',
'LastName': 'Doe', 'ID': 1L, 'JoiningDate': datetime.datetime(2013, 1, 1, 0,
12, 12, 123000)}
{'EmployeeID': 'E10032 ', 'FirstName': 'Oliver', 'AreaCode': 'CA000 ',
'LastName': 'Blume', 'ID': 2L, 'JoiningDate': datetime.datetime(2012, 1, 1, 8,
0, 0, 123000)}
{'EmployeeID': 'E11033 ', 'FirstName': 'Jonathan', 'AreaCode': 'CA001 ',
'LastName': 'J', 'ID': 21L, 'JoiningDate': datetime.datetime(2012, 12, 1, 12,
12, 12)}
Original comment by srujan.v...@gmail.com
on 9 Apr 2013 at 9:44
Thanks, Srujan for verifying!
Original comment by msabr...@gmail.com
on 9 Apr 2013 at 10:17
Original issue reported on code.google.com by
kalucki....@gmail.com
on 25 Jun 2012 at 11:19