Skip to content
Search
Examples

Reading

Description

from_data_frame() reads one frame as the source of another, so a pipeline can be composed from smaller ones.

Documentation

Readers are extractors: they yield Rows and describe the schema they produce.

Code

<?php

declare(strict_types=1);

use function Flow\ETL\DSL\{data_frame, from_array, from_data_frame, lit, ref, to_output};

require __DIR__ . '/vendor/autoload.php';

data_frame()
    ->read(
        from_data_frame(
            data_frame()
                ->read(from_array(
                    [
                        ['id' => 1],
                        ['id' => 2],
                        ['id' => 3],
                        ['id' => 4],
                        ['id' => 5],
                    ]
                ))
                ->withEntry('timestamp', ref('id')->multiply(lit(10000)))
        )
    )
    ->collect()
    ->write(to_output(truncate: false))
    ->run();
Contributors

Built in the open.

Join us on GitHub
scroll back to top