-
Notifications
You must be signed in to change notification settings - Fork 3
Description
I am a big fan of the "Show don't tell" approach when learning a new tool like Metafacture. Just show me some meaningful examples so I can get an idea of what you can do with it. Tell me about the concepts behind it later.
For a 5 min intro i don't think paragraphs like this one
To handle metadata records and ETL (Extract - Transform - Load) we have to build UNIX-like pipelines. For each step in a pipeline we use FLUX commands/modules. Each FLUX command aids a specific modular step in an ETL process that usually can be subsumed under one of the following steps:
→ read → decode → transform → encode → write →
are absolutely essential.
Here is my version of the "Hello world" example:
HELLO WORLD
Prepare a helloWord.flux
file:
$ cat helloWord.flux
"Hello World"
| print
;
Run this Flux script using the CLI Metafacture Runner.
$ $ ./bin/metafix-runner helloWord.flux
Hello World
Or run this example in Playground
The same works, when we start with a JSON file:
$ cat file.json
{"hello":"world"}
Create a second Flux file:
$ cat helloWorld2.flux
"file.json"
| open-file
| as-lines
| print
;
Run your second Flux file:
$ $ ./bin/metafix-runner helloWord2.flux
Hello World
Be sure to have file.json
in the same directory.
Here we ask Metafacture to open the file file.json
, read each line separately as a string and generate the string on standard output.
For each step we use Flux commands/modules which are piped into another using the |
sign.
What do you think?