Prepare file manipulating configurations

In the previous section you prepared production configurations that manipulate tables. In this section you’ll create the production configurations that work with files.

Prepare the production configurations

You’ll create a production Python transformation with a code that works with files.

You’ll create a production Python transformation with a simple code first.

Create Transformation

In your testing project, create a new Python transformation and name it Sample Python transformation.

Screenshot - Create Transformation

Add a new code in Block 1 named Hello world, insert the following code and save it.

f = open("out/files/demoFile.txt", "a")
f.write("Hello World!")
f.close ()

Screenshot - New codeblock

Set Output Mapping

Now go to the section File Output Mapping and click New File Output. And because the output of the transformation will be the file demoFile.txt, let’s set it as Source and demoOutput as Tags. This means that the output will be stored in Storage as demoFile.txt with the tag demoOutput. Click Add File Output.

Screenshot - Set Output Mapping

Here is the finished transformation.

Screenshot - Python transformation overview

Run Transformation

Let’s run the component.

After the job is finished, go to Storage – Files, where you can see the file demoFile.txt generated.

Screenshot - Generated File

Now you have everything ready, you created production configurations for both tables and files. You can proceed to the next step - working with tables in a branch where you first learn how tables work in branches. Then in the following section you’ll learn how files work in branch.