Hi @HaveF , a component can be considered as what a function is in programming languages, so they do not usually have a link to a file, but rather would take input parameters - either some data that can be read from a file, or perhaps a link to a file path (as data row or as a variable).
While some components can have some data, for example a list for mapping, this can be stored in a table within the component.
Can you tell us a bit more what your component is doing, and how the file you want to attach to it is related to the component?
Yes, component is a function, and it is a pure function
Here is my case:
I want to use some Java Jar file in Java Snippet as additional libraries, I don’t know where to put them If I want to make this part as a component.
Of course I can put it on some specific positions, but if I want to share the component with others, like on KNIME hub, it seems I still tell others to download jar file, and put it some where. It just looks awkward.
@HaveF I have created an example like this. You have a code as a string and dynamically write that to a (temporary) folder and use that as a source. The example is about a Python code. Maybe you can adapt that.
@HaveF no worries discussing ideas and selecting the best is one aim of this forum. If you can savely provide a Component or a JAR file on a central storage this might be the best solution. If people would load a whole workflow you might be able to use the /data/ folder. In the other thread there were suggestions of putting the (Python) code on a repository - you also might think about a company repository (with JFrog/Artifactory or something similar).
The thing with dynamically creating a .PY file from a KNIME node and reading that back is more like a hack to have everything within KNIME nodes. Might not really be a serious option, more to demonstrate that if you have restrictions you still could do this
Hi @HaveF ahhh, jar files… this is certainly a good use case. I chose not to create public components if they were dependent on jar files. For internal usage, that is components that gonna run on the same machine, such as in your case where you simply want to reuse the component in the same workflow and to benefit from the “auto-update” when updating the component, then you can leave the path to the jar file hardcoded inside the component. The component itself does not need to include the jar file, as long as the jar file exists at the path it’s pointing to.
Alternatively, there are some libraries that come with Knime, and if the jar file you wanted to include already comes with Knime, then you don’t have to include the jar file and simply configure your Java Snippet to use it (or multiple ones).
You can do this in the “Additional Bundles” tab in the Java Snippet node:
Hi @HaveF , but isn’t this applicable to anything we do within the component? Nodes deprecated, etc. But that’s the beauty of the using components, where you can update the component, and any workflow that’s linked to the component will be updated