Force Column types for multiple columns

Here is my situation for background. I am new to Knime. I have created a flow that Uses the Python Script node to call an API. The output is a table that I want to append to an MS SQL table. I am automating this run daily for yesterday’s data.

The problem I have is that sometimes some columns in my table are blank and Knime likes to set the Data type to “Data Cell”. Then to flow fails b/c of the type mismatch when it tries to write to DB table.

Its not just the “Data Cells” issues either. The columns number data like to change their types as well. One day its a “int” other its trying to make it a “double”.

I tired to define the data types in the Python script but once the data is out of the node and in Knime to be used by another node Knime auto detects the type anyway.

The only solution I have found is to squash the types mismatches as they pop up by adding a String manipulator, or other number type converting node. These all seem to be single column options. My current data set only have 45 columns but in the future Ill be working with data sets of 100+ column. There has to be a better way to set the data types that doesn’t involve dozens of nodes changing single columns at a time.

Ohh and the Sting Manipulator (multi column) cant change the data type for most columns. I get a weird error.

TLDR: Knime’s data type auto detect is junk how to manually control it with out adding a 100 nodes?

Here is a method that I use to lock them in.

Force_Column_Types.knwf (269.5 KB)

@djmoney you could try and employ the Table Validator (Reference)

1 Like

Maybe it is an option to check the column data types in the Python script and cast new of needed.