python - NoneType object is not iterable error in pandas -


i trying pull data stored proc on sql server using python.

here code:

import datetime dt import pyodbc import pandas pd  conn = pyodbc.connect('trusted_connection=yes', driver = '{sql server native client 11.0}',server = '*****, database = '**')  pd.read_sql("exec ******** '20140528'",conn) 

i error: typeerror: 'nonetype' object not iterable

i suspect because have cell in sql table value null not sure if that's true reason why getting error. have run many sql statements using same code without errors.

here's traceback:

in[39]: pd.read_sql("exec [dbo].[] '20140528'",conn) traceback (most recent call last):   file "c:*", line 3032, in run_code     exec(code_obj, self.user_global_ns, self.user_ns)   file "<ipython-input-39-68fb1c956dd7>", line 1, in <module>     pd.read_sql("exec [dbo].[] '20140528'",conn)   file "c:*", line 467, in read_sql     chunksize=chunksize   file "c:***", line 1404, in read_query     columns = [col_desc[0] col_desc in cursor.description] typeerror: 'nonetype' object not iterable 

your sproc needs

set nocount on; 

without sql return rowcount call, come without column name, causing nonetype error.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -