Export to GitHub

pypyodbc - issue #8

TypeError: 'int' object is not subscriptable with single row Sql Server query


Posted on Feb 22, 2013 by Grumpy Horse

What steps will reproduce the problem? 1. Connect to a Sql Server 2005/2008 2. Run this query

SELECT SYSTEM_USER AS UserName, @@SERVICENAME As ServiceName, @@version AS Version, SERVERPROPERTY('Edition') AS Edition, SERVERPROPERTY('InstanceName') AS Instance, SERVERPROPERTY('IsIntegratedSecurityOnly') AS IsIntegratedSecurityOnly, SERVERPROPERTY('IsSingleUser') AS IsSingleUser, SERVERPROPERTY('MachineName') AS MachineName, SERVERPROPERTY('ProductVersion') AS ProductVersion, SERVERPROPERTY('ProductLevel') AS ProductLevel, SERVERPROPERTY('ServerName') AS ServerName, DATABASEPROPERTYEX('Factu01', 'RECOVERY') AS RecoveryMode, SERVERPROPERTY('SqlCharSetName') AS SqlCharSetName

con.cursor().execute(sql).fetchall()

What is the expected output? What do you see instead?

Get the error:

File "C:\Proyectos\TeleportServer\SqlServerEngine.py", line 156, in selectSql cursor.execute(sql) File "C:\Programacion\Python\27\lib\site-packages\pypyodbc.py", line 1305, in execute self.execdirect(query_string) File "C:\Programacion\Python\27\lib\site-packages\pypyodbc.py", line 1340, in execdirect self._UpdateDesc() File "C:\Programacion\Python\27\lib\site-packages\pypyodbc.py", line 1707, in _UpdateDesc ColDescr.append((col_name, SQL_data_type_dict.get(Ctype_code.value,(Ctype_code.value))[0],Cdisp_size.value,\ TypeError: 'int' object is not subscriptable

What version of the product are you using? On what operating system?

Windows 7 64, Sql Server 2008, Python 2.7, last release version of pypyodbc from pip

Comment #1

Posted on Feb 24, 2013 by Helpful Camel

The latest version should be able to fix this: http://code.google.com/p/pypyodbc/source/browse/trunk/pypyodbc/pypyodbc.py

Comment #2

Posted on Feb 24, 2013 by Helpful Camel

The latest version should be able to fix this: http://code.google.com/p/pypyodbc/source/browse/trunk/pypyodbc/pypyodbc.py

Comment #3

Posted on Feb 28, 2013 by Helpful Camel

(No comment was entered for this change.)

Status: Fixed

Labels:
Type-Defect Priority-Medium