|
| 1 | +# skardi |
| 2 | + |
| 3 | +High-performance query engine for AI and agents, powered by [Apache DataFusion](https://datafusion.apache.org/). |
| 4 | + |
| 5 | +Query files, databases, data lakes, and vector stores with SQL — and serve results as parameterized pipelines. |
| 6 | + |
| 7 | +[](https://crates.io/crates/skardi) |
| 8 | +[](https://docs.rs/skardi) |
| 9 | +[](https://github.com/SkardiLabs/skardi/blob/main/LICENSE) |
| 10 | + |
| 11 | +## Modules |
| 12 | + |
| 13 | +| Module | Description | |
| 14 | +|--------|-------------| |
| 15 | +| `engine` | SQL query execution engine backed by DataFusion | |
| 16 | +| `pipeline` | Declarative SQL pipelines with parameter inference | |
| 17 | +| `model` | ONNX model loading and inference (behind `onnx` feature) | |
| 18 | +| `sources` | Data source connectors: CSV, Parquet, PostgreSQL, MySQL, SQLite, MongoDB, Redis, Iceberg, Lance | |
| 19 | + |
| 20 | +## Installation |
| 21 | + |
| 22 | +```toml |
| 23 | +[dependencies] |
| 24 | +skardi = "0.1" |
| 25 | + |
| 26 | +# With ONNX model inference |
| 27 | +skardi = { version = "0.1", features = ["onnx"] } |
| 28 | +``` |
| 29 | + |
| 30 | +## Quick Start |
| 31 | + |
| 32 | +### Execute a SQL query |
| 33 | + |
| 34 | +```rust,no_run |
| 35 | +use skardi::engine::datafusion::DataFusionEngine; |
| 36 | +use skardi::engine::Engine; |
| 37 | +use datafusion::prelude::*; |
| 38 | +
|
| 39 | +#[tokio::main] |
| 40 | +async fn main() -> anyhow::Result<()> { |
| 41 | + let ctx = SessionContext::new(); |
| 42 | + ctx.register_csv("products", "data/products.csv", CsvReadOptions::new()).await?; |
| 43 | +
|
| 44 | + let engine = DataFusionEngine::new(ctx); |
| 45 | + let result = engine.execute("SELECT * FROM products WHERE price < 100").await?; |
| 46 | +
|
| 47 | + println!("{} rows returned", result.num_rows()); |
| 48 | + Ok(()) |
| 49 | +} |
| 50 | +``` |
| 51 | + |
| 52 | +### Load and run a pipeline |
| 53 | + |
| 54 | +```rust,no_run |
| 55 | +use skardi::pipeline::pipeline::{Pipeline, StandardPipeline}; |
| 56 | +use datafusion::prelude::*; |
| 57 | +use std::sync::Arc; |
| 58 | +
|
| 59 | +#[tokio::main] |
| 60 | +async fn main() -> anyhow::Result<()> { |
| 61 | + let ctx = Arc::new(SessionContext::new()); |
| 62 | +
|
| 63 | + // Pipeline YAML defines a parameterized SQL query |
| 64 | + let pipeline = StandardPipeline::load_from_file("pipeline.yaml", ctx).await?; |
| 65 | +
|
| 66 | + println!("Pipeline: {} v{}", pipeline.name(), pipeline.version()); |
| 67 | + Ok(()) |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | +A pipeline YAML looks like this: |
| 72 | + |
| 73 | +```yaml |
| 74 | +metadata: |
| 75 | + name: product-search |
| 76 | + version: 1.0.0 |
| 77 | + |
| 78 | +query: | |
| 79 | + SELECT name, price FROM products |
| 80 | + WHERE ({brand} IS NULL OR brand = {brand}) |
| 81 | + AND price < {max_price} |
| 82 | + LIMIT {limit} |
| 83 | +``` |
| 84 | +
|
| 85 | +Parameters are automatically inferred from `{placeholders}` in the SQL. |
| 86 | + |
| 87 | +## Feature Flags |
| 88 | + |
| 89 | +| Feature | Description | |
| 90 | +|---------|-------------| |
| 91 | +| `onnx` | Enables ONNX model inference via the `model` module | |
| 92 | + |
| 93 | +## Further Reading |
| 94 | + |
| 95 | +- [API Reference](https://docs.rs/skardi) — full rustdoc for all modules |
| 96 | +- [GitHub Repository](https://github.com/SkardiLabs/skardi) — server, CLI, demos, and deployment guide |
| 97 | +- [Crate Page](https://crates.io/crates/skardi) |
| 98 | + |
| 99 | +## License |
| 100 | + |
| 101 | +Apache-2.0 |
0 commit comments