1

I have Netezza database at remote server and i am trying to write to the database using Pyodbc.

The connection work's while reading from the database..However while trying to write i am not able to write to the Netezza database. It shows the following error:

"Error: ('HY000', '[HY000] ERROR: Column 4 : Field cannot contain null values (46) (SQLExecDirectW)')"

On further inspecting the Column 4, i found no Null value in the specified problem.

Also, the snippet of the code which i am using to write to the database is as follows:

for row in Full_Text_All.itertuples():
     srows = str(row[1:]).strip("()")
     query2 = "insert into MERGED_SOURCES values('+srows+')"

where, Full_Text_All is the name of the dataframe MERGED_SOURCES is the name of the table.

Shoaib
  • 11
  • 1

1 Answers1

1

It might be that Column 4 has been defined as NOT NULL when the table was created. If you may have access to the DDL of the table, you should be able to check this.

If the NOT NULL option was specified for Column 4, I suggest you to double check the data you are trying to insert into the table: for them, the value correspondent to Column 4 should not be null.

pascaie
  • 11
  • 2
  • Hi Pascaie..Thanks for your swift response.. I have checked the Table and no NOT NULL Constraints have been used while defining any column. Also, I have cross checked the dataframe and no NA's Null exist!! However there exist's a none value in the dataframe.. Is there any way its a problem while reading from Netteza into Python? Something like implicit type conversion? – Shoaib Jan 31 '19 at 14:27