Quickstart
Write a contract for a small CSV file, run Floe on it, and read the three outputs: accepted rows, rejected rows with their reasons, and the run report. It takes about five minutes and needs only Python 3.11 or later.
1. Install Floe
Section titled “1. Install Floe”python -m venv .venv. .venv/bin/activatepip install floe-pythonfloe --versionInstallation covers uv, Docker and the optional extras for S3, Iceberg and Excel.
2. Add a raw file
Section titled “2. Add a raw file”Create in/orders.csv. Three of its five rows are wrong: an amount that is not
a number, an order id seen twice, and a missing order id.
order_id,amount1001,19.901002,not_a_number1003,42.001003,7.50,5.003. Write the contract
Section titled “3. Write the contract”Create floe.yml next to the in folder:
version: "1.0"entities: - name: orders source: format: csv path: ./in options: separator: "," # Floe reads ";" unless told otherwise sink: accepted: format: parquet path: ./out/accepted/orders rejected: format: csv path: ./out/rejected/orders policy: severity: reject # reject the bad rows, keep the good ones schema: unique_keys: [[order_id]] # no duplicates columns: - name: order_id type: string nullable: false # required - name: amount type: "decimal(10,2)"The contract says: read every CSV file in ./in as the orders entity; each
row must have an order_id that is present and unique, and an amount that is
a decimal with two digits after the point. Rows that pass go to Parquet, rows
that fail go to a CSV quarantine.
4. Validate the contract
Section titled “4. Validate the contract”floe validate -c floe.ymlConfig valid: /path/to/quickstart/floe.ymlVersion: 1.0Report: reportEntities: 1Entity: orders Source: csv (./in) Sink accepted: parquet (./out/accepted/orders) Sink rejected: csv (./out/rejected/orders) Severity: rejectNext: floe run -c /path/to/quickstart/floe.ymlFloe prints the absolute path to your config. floe validate reads no data.
Run it in CI on every change to a contract.
5. Run it
Section titled “5. Run it”floe run -c floe.ymlThe run summarizes the files and rows processed.
Totals: files=1 rows=5 accepted=2 rejected=3Overall: rejected (exit_code=0)Two rows were accepted and three rejected. A run with rejected rows still
exits 0: rejecting rows is the contract working, not a failure.
6. Read the results
Section titled “6. Read the results”Accepted rows are a Parquet dataset, typed as the contract declares:
python -c "import polars as pl; print(pl.read_parquet('out/accepted/orders'))"shape: (2, 2)┌──────────┬───────────────┐│ order_id ┆ amount ││ --- ┆ --- ││ str ┆ decimal[10,2] │╞══════════╪═══════════════╡│ 1001 ┆ 19.90 ││ 1003 ┆ 42.00 │└──────────┴───────────────┘Rejected rows keep their raw values, row position, rule failures, run ID and source URI. Read the generated part file to inspect them.
cat out/rejected/orders/part-*.csvorder_id,amount,__floe_row_index,__floe_errors,__floe_run_id,__floe_source_uri1002,not_a_number,1,"[{""rule"":""cast_error"",""column"":""amount"",""message"":""invalid value for target type""}]",<run_id>,local:///path/to/quickstart/in/orders.csv1003,7.50,3,"[{""rule"":""unique"",""column"":""order_id"",""message"":""duplicate value""}]",<run_id>,local:///path/to/quickstart/in/orders.csv,5.00,4,"[{""rule"":""not_null"",""column"":""order_id"",""message"":""required value missing""}]",<run_id>,local:///path/to/quickstart/in/orders.csvThe first 1003 was accepted; the second is the duplicate.
The run report is JSON under report/run_<run_id>/: a
run.summary.json for the run and one run.json per entity, with counts,
statuses, timings and the files written.
report/run_<run_id>/run.summary.jsonreport/run_<run_id>/orders/run.jsonRun report documents every key.
7. Try another severity
Section titled “7. Try another severity”Change severity: reject to warn and run again: all five rows are accepted
(the bad amount becomes null), and the run ends success_with_warnings. Change
it to abort: the whole file is rejected, nothing is accepted, and the run
exits 2, which an orchestrator treats as a failure. The severity is how a
contract says how strict to be; Checks and severity
gives the full rules.
- Data contracts: every part of a contract, and how to design one.
- Config reference: every field.
example/: a larger project with several entities, profiles and S3.
Synced from floe @ v1.1.0 (313b534), docs/get-started/quickstart.md.