tree: 9aac61d7a1211287db791652fb256cecb596ae43 [path history] [tgz]
  1. data/
  2. dataflows/
  3. all_functions.png
  4. LICENSE
  5. README.md
  6. requirements.txt
  7. run.py
examples/ibis/jaffle_shop/README.md

Jaffle shop

This repository is a reimplementation of the canonical dbt example jaffle_shop. It illustrates data transformations for an ecommerce store.

Data transformations are implemented using the Python library Ibis which allows to define SQL operations that works across backends. By default, it uses duckdb for local development. Hamilton + Ibis provides a Python-centric alternative to dbt (Learn more).

Content

The content and structure aims to match the original dbt jaffle_shop example. On the other hand, Hamilton is just a Python library and is flexible regarding project structure.

  • data/: samples data; equivalent to seeds/ in the dbt repo.
  • dataflows/staging load raw data and rename columns to avoid naming conflicts; equivalent to models/staging/ in the dbt repo.
  • dataflows/customer_flow.py and dataflows/order_flow.py define data transformations; equivalent to models/customers.sql and models/orders.sql in the dbt repo.
  • run.py specify where to load data from and how to execute dataflows.

Generally, you'll notice Hamilton aims to reduce the sprawl of configurations (.yaml) and documentation (.md). Instead, it uses docstrings, type hints, or Python object to couple them to with your code (.py).

Set up

  1. create and activate virtual environment

    python -m venv venv & . venv/bin/activate
    
  2. install requirements

    pip install -r requirements.txt
    
  3. execute the Hamilton dataflow

    python run.py
    

Resources

Jaffle shop is an example used by many different frameworks, which can ground comparisons between each other.