Inserting Binary Data into SQL Database Using KNIME

@SnigdhaBiswas I sent the data provided by @takbb thru a Python node with pandas dataframe and they go right thru and later can be used as binary image files. So this does work.

import knime.scripting.io as knio

# This example script simply outputs the node's input table.

df = knio.input_tables[0].to_pandas()

# Getting the data types of each column
dtypes_series = df.dtypes

# Converting the Series to a DataFrame
dtypes_df = dtypes_series.reset_index()
dtypes_df.columns = ['Column', 'DataType']

# Ensuring both columns are of type string
dtypes_df['Column'] = dtypes_df['Column'].astype(str)
dtypes_df['DataType'] = dtypes_df['DataType'].astype(str)

knio.output_tables[0] = knio.Table.from_pandas(df)
knio.output_tables[1] = knio.Table.from_pandas(dtypes_df)

Upload binary files to database.knwf (318.4 KB)

2 Likes