A reader given no schema infers one from the file. Declaring the same schema by hand produces the identical result - and saves the reader from having to look.
Examples
Getting started
Description
Documentation
A reader either infers the schema from its source or is handed one.
Code
<?php
declare(strict_types=1);
use function Flow\ETL\Adapter\CSV\from_csv;
use function Flow\ETL\DSL\{data_frame, float_schema, schema, schema_to_ascii, uuid_schema};
require __DIR__ . '/vendor/autoload.php';
$path = __DIR__ . '/data/orders.csv';
// no schema given: Flow reads the file's own description of itself
echo "inferred:\n" . schema_to_ascii(
data_frame()->read(from_csv($path))->select('order_id', 'discount')->schema(),
);
// declared up front: the reader is told, and never has to look
$declared = schema(uuid_schema('order_id', nullable: true), float_schema('discount', nullable: true));
echo "\ndeclared:\n" . schema_to_ascii(
data_frame()->read(from_csv($path, schema: $declared))->select('order_id', 'discount')->schema(),
);