Extracts
Read from various data sources.
Transforms
Shape and optimize for your needs.
Loads
Store and secure in one of many available data sinks.
Examples:
Code
<?php
declare(strict_types=1);
use function Flow\ETL\DSL\{data_frame, from_path_partitions, ref, to_stream};
require __DIR__ . '/../../../autoload.php';
data_frame()
->read(from_path_partitions(__DIR__ . '/input/color=*/sku=*/*.csv'))
->withEntry('path', ref('path')->strReplace(__DIR__, '/__ABSOLUTE_PATH__'))
->collect()
->write(to_stream(__DIR__ . '/output.txt', truncate: false))
->run();
Output
+-------------------------------------------------------------------------------------+-------------------------------------+
| path | partitions |
+-------------------------------------------------------------------------------------+-------------------------------------+
| file://__ABSOLUTE_PATH__/input/color=blue/sku=PRODUCT01/65c7e9bc4460a568233195.csv | {"color":"blue","sku":"PRODUCT01"} |
| file://__ABSOLUTE_PATH__/input/color=blue/sku=PRODUCT02/65c7e9bc446c2326068326.csv | {"color":"blue","sku":"PRODUCT02"} |
| file://__ABSOLUTE_PATH__/input/color=green/sku=PRODUCT01/65c7e9bc44305321518126.csv | {"color":"green","sku":"PRODUCT01"} |
| file://__ABSOLUTE_PATH__/input/color=green/sku=PRODUCT02/65c7e9bc44421020940545.csv | {"color":"green","sku":"PRODUCT02"} |
| file://__ABSOLUTE_PATH__/input/color=green/sku=PRODUCT03/65c7e9bc44515031584752.csv | {"color":"green","sku":"PRODUCT03"} |
| file://__ABSOLUTE_PATH__/input/color=red/sku=PRODUCT01/65c7e9bc4386f958078278.csv | {"color":"red","sku":"PRODUCT01"} |
| file://__ABSOLUTE_PATH__/input/color=red/sku=PRODUCT02/65c7e9bc440fa083889144.csv | {"color":"red","sku":"PRODUCT02"} |
| file://__ABSOLUTE_PATH__/input/color=red/sku=PRODUCT03/65c7e9bc44209401416287.csv | {"color":"red","sku":"PRODUCT03"} |
+-------------------------------------------------------------------------------------+-------------------------------------+
8 rows