Python Node Development - Data Type Checking

Hi,

I am developing a new node using Python.
To select a column, I want to display only columns containing a Binary Object.
I am using a function (described below) that works for types such as String and Int.
How can I check that it is a Binary Object ? I tried to use the type “blob” but it’s not work. I also tried the type “logical()” but I need to specify a value type, and none works (tried to use BinaryObjectDataCell, and others).

Any advice on that point ?

Thanks
Best regards
Jerome

def is_binary(column):
return (
column.ktype == knext.int64
)

Hey,

sorry for the delay. Could it be that you did not use the brackets? ()

column.ktype == knext.blob()

With that it works here.

And I am wondering: what is the use case for you using binary objects here? That’d interest me :slight_smile:

Best regards
Steffen

Hi,

Thanks for the tips but it doesn’t work.

results in :

image

But I have a blot column in the table :

And 2 values, when logging the column type are :

base64encoder:extension<logical={“value_factory_class”:“org.knime.core.data.v2.value.cell.DictEncodedDataCellValueFactory”,“data_type”:{“cell_class”:“org.knime.core.data.blob.BinaryObjectDataCell”}}, storage=struct<blob[dict_encoding=LONG_KEY], string[dict_encoding=INT_KEY]>>

That is the one I want to find.

We have some manipulation to do on a blob, and I use that use case to familiarize with the dev.

Best regards
Jerome

Hi @trj,

thanks for the details!

We realized that currently it is not possible (but planned) to filter for blob columns or use them in pure-Python nodes.

Not very nice, but possible could be to convert it to byte vectors or just strings and test them in the Python node whether they are base64 encodable (see Stackoverflow).

Does that help a little further?

Best regards
Steffen

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.