clair¶
Python-native data transformations for Snowflake.
from clair import Trouve
from refined.products.catalog import trouve as catalog
from refined.products.reviews import trouve as reviews
trouve = Trouve(
sql=f"""
SELECT
c.product_id,
c.name,
avg(r.rating) AS avg_rating,
count(*) AS review_count
FROM {catalog} c
JOIN {reviews} r ON c.product_id = r.product_id
GROUP BY 1, 2
""",
)
Import the upstream Trouve and use it in the f-string. clair does the rest.
Why clair¶
- Dependencies are Python imports. clair reads the lineage from the import graph, not from a separate metadata layer.
- Compile first, run second.
clair compileresolves the full DAG and writes SQL to_clairtifacts/before it connects to Snowflake. - clair includes incremental strategies. Use APPEND and UPSERT modes with no boilerplate. Attach a
RunConfigto anyTrouve. - Data quality as code. Tests are Pydantic objects on the Trouve itself, not a separate test file.
- Pandas-native transformations. Use a
PandasTrouveto write any step as a Python function. clair reads the upstream tables as DataFrames, runs your code on your machine, then writes the result to Snowflake.
Install¶
Show the version:
Quick links¶
- Quickstart — from zero to first run
- CLI reference — all commands and flags
- Concepts — Trouve, DAG, environments
- Reference — Python API