Skip to content
Advertisement

Using cx_Oracle for Python and receiving TypeError: ‘NoneType’ object is not iterable when inserting data to table

I am trying to insert data into a Oracle database. I have to use a proxy to have insert permissions. Below is the code that I run, but I’m getting the error ‘TypeError: ‘NoneType’ object is not iterable’ at the line ”’,conn).

I’m not sure where to go from here. Does anyone know what I’m doing wrong? Full error message is below the query code.

Advertisement

Answer

An INSERT statement does not return a result set.

You are using pandas.read_sql_query which:

Returns a DataFrame corresponding to the result set of the query string.

However, since your query is not returning a result set then this is the reason the error is generated; you are using the wrong method to insert values.

You appear to need to insert using cx_oracle rather than trying to do it through pandas.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement