In this part of the tutorial, you will see how to use input mapping. Input mapping defines what data your component receives from the end users’ project. A component never operates on data in a project’s Storage, it always receives a copy of the selected data.
Input mapping is therefore used when your component needs to read data from the customer project – these are typically writers and applications. Implementing the input mapping requires three steps:
Save the changes, and the corresponding UI elements will appear in your component configuration. Keep in mind that the changes take up to 5 minutes to propagate to all KBC instances.
You also need to modify the source code so that it works with the input data. The data from input mapping will be available in the
/data/in/files folders when the component is
run. This is almost identical to writing
Transformation code – the only difference is that you need to
use absolute paths (or the
KBC_DATADIR environment variable).
Commit and push the code in your repository, and tag it with a normal version tag. This will trigger a build on Travis CI and automatically deploy the new version into KBC. Keep in mind that after the deployment, it may take up to 5 minutes for the update to propagate to all KBC instances.
If you configured the UI correctly, you should see the corresponding control in the component configuration page.
Add a New Table Input, select an arbitrary table from the project, and make sure to set Destination to
so that the final path matches
/data/in/tables/source.csv, which is what you are expecting in the code.
Now run the component and you should see the proper message in job events.
Your component can now successfully read a provided table. You can learn more about other input mapping options in the data folder specification. Also, the manifest files contain metadata which might be useful in your component. The next part of the tutorial will show you how to create output mapping.