Expand description
SQL-native ELT engine — single binary, no runtime required.
Hone walks a directory of .sql files, builds a dependency graph by parsing
FROM / JOIN clauses, and executes every asset in the correct order —
running independent assets in parallel within each wave.
§Quick start
ⓘ
use hinge::{BuildGraph, RunAll, PostgresExecutor};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let graph = BuildGraph::from_dir("models")?;
let executor = PostgresExecutor::new("postgresql://user:pass@localhost/mydb").await?;
RunAll::new(graph, executor).execute().await?;
Ok(())
}§File layout
models/
raw/
events.sql → raw.events
staging/
orders.sql → staging.orders (SELECT … FROM raw.events)
mart/
revenue.sql → mart.revenue (SELECT … FROM staging.orders)Dependencies are resolved automatically — no ref() calls, no manifest files.
§Asset kinds
Declare the output type with a header comment at the top of the file.
Defaults to view when absent.
-- @kind: table
-- @kind: view
-- @kind: materialized_view
SELECT …§Run modes
| Type | Behaviour |
|---|---|
RunAll | Full graph in dependency order |
RunUpstream | All ancestors of a node, then the node itself |
RunDownstream | The node, then all its descendants |
RunBidirectional | Both directions from a node |
Every run type exposes .plan() for a dry-run preview that resolves the
execution order without connecting to the database.
Structs§
- Asset
- A SQL asset: a named SQL fragment that produces a relation in a database.
- Asset
Reference - A
schema.namepair that uniquely identifies an asset in the graph. - Asset
Source - The SQL body of an asset — the
SELECTstatement that defines it. - Build
Graph - Scans a directory of
.sqlfiles and builds aGraphwith automatic dependency resolution. - Click
House Executor - Executes SQL assets against a ClickHouse server.
- Duck
DbExecutor - Executes SQL assets against a DuckDB database.
- Engine
- Graph
- A directed acyclic graph (DAG) of SQL assets.
- Postgres
Executor - Executes SQL assets against a PostgreSQL database.
- RunAll
- Executes all assets in the graph in topological order.
- RunBidirectional
- Executes the full upstream subgraph, the target asset, then the full downstream subgraph.
- RunDownstream
- Executes a target asset, then all assets that depend on it.
- RunUpstream
- Executes all ancestors of a target asset, then the asset itself.
- Snowflake
Executor - Executes SQL assets against a Snowflake data warehouse.
Enums§
- Asset
Error - Errors returned when constructing asset value objects.
- Asset
Kind - The type of database object an asset produces.
- Build
Graph Error - Errors that can occur while scanning a models directory and building the graph.
- Duck
DbConnection Error - Executor
Error - Error returned when an asset fails to execute against the database.
- Graph
Error - Errors returned when building a
Graph. - Snowflake
Connection Error
Traits§
- Executor
- Executes a single SQL asset against a database.