Expand description
Timelake: the open time-series lakehouse. Tables are Apache Iceberg tables on any object store, laid out for time series (partitioned by time, sorted by series and time), kept compact by the writer itself, and queried with DataFusion.
use timelake::{Lake, Session, TableOptions};
let lake = Lake::open("s3://bucket/warehouse", Default::default())?;
let opts = TableOptions {
time_column: Some("time".into()),
series_key: vec!["device_id".into()],
..Default::default()
};
let table = lake.create_table("iot.readings", &batch.schema(), opts).await?;
let (table, result) = table.append(&[batch], Default::default()).await?;
let session = Session::new(lake);
let rows = session.sql("SELECT * FROM iot.readings WHERE device_id = 7").await?.collect().await?;
let latest = session.latest("iot.readings").await?.collect().await?;Re-exports§
pub use arrow;pub use datafusion;
Modules§
- bounds
- Iceberg single-value serialization of column bounds (manifest
lower_bounds/upper_bounds). https://iceberg.apache.org/spec/#binary-single-value-serialization - contract
- The Timelake table contract (SPEC §7.1): which column is time, which columns identify a series,
and the layout/maintenance policy derived from them. Stored as
timelake.*Iceberg table properties (seeproperty), so the contract travels with the table and other engines simply ignore it. - head
- The head object (SPEC §19.2, P1):
<table>/metadata/timelake-head, one object holding what a reader needs to plan a query at the current version: the table metadata, the live data files with their column statistics, and the last-value index when it fits. A cold query reads it instead of following the version hint, metadata, manifest list and manifests one by one. - property
- Table property keys holding the
Contract. - settings
- The registry of Timelake’s settings (SPEC §21.9): every switch is declared once here, with its
type, default, the levels it may be set at, and the version that added it. Table properties,
SQL
SET, the CLI’stimelake settingsand the docs all come fromSETTINGS. - storage
- Object storage access. One
object_storeclient serves everything: Iceberg metadata (through an adapter that implements iceberg-rust’sStoragetrait), Parquet data written by Timelake, and DataFusion scans. Anyobject_storebackend works: S3 and S3-compatible stores (R2,RustFS,MinIO), GCS, Azure, and local disk. - summary
- Snapshot summary keys: Timelake’s own, and the standard Iceberg counters Timelake maintains.
Structs§
- Append
Options - Options for
Table::append. - Append
Result - What
Table::appenddid. - Commit
Info - How a commit went.
- Contract
- The parsed contract of an existing table.
- Lake
- A warehouse: a root location holding namespaces and tables. Cheap to clone; clones share the storage client and caches.
- Live
Entry - A manifest entry of a data file, with inherited snapshot id and sequence numbers resolved.
- Maintain
Options - Options for
Table::maintain. The default does everything, rewriting each partition into sorted files of the target size. - Maintain
Report - What
Table::maintaindid. - Session
- A SQL session over a lake. Tables are addressed as
namespace.table(or justtablein thedefaultnamespace) and always read at their latest committed version. - Session
Settings - Timelake settings for one session; unset ones follow each table’s properties.
- Table
- A table at one committed version. Cheap to clone; call
Table::refreshto see newer commits. - Table
Name - A validated table name:
namespace.table, or justtablein theDEFAULT_NAMESPACE. Both parts use[A-Za-z0-9_-], so they are safe as path segments. - Table
Options - Options for creating a table. Only
time_columnis required for a time-series table; leave it unset for a plain (dimension) table such as device metadata. - Upgrade
Options - Options for
Table::upgrade. - Upgrade
Report - What
Table::upgradedid (or, withdry_run, would do).
Enums§
- Chunk
- Time partition granularity: how much time one partition covers.
- Error
- Errors from Timelake operations.
- Rollup
Refresh - Which rollups a refresh brings up to date.
- Rollup
Statement CREATE,DROPorREFRESH MATERIALIZED ROLLUP.- Statement
- One SQL statement, as
Session::parsesplits a script. - Upgrade
Step - One change an upgrade makes, in the order it makes them.
Constants§
- DEFAULT_
NAMESPACE - Namespace of table names given without one.
Functions§
- align_
batch - Casts and reorders a batch to the table schema by column name. Missing nullable columns are filled with nulls; extra columns are an error (add them to the schema first).
- file_
partition - Partition value of a data file written by Timelake (
Noneif unpartitioned). - flush
- Waits for the background writes this process started. Call it before the process exits, or the last commit’s version hint and head may not be updated: readers still find the newest version, but need extra requests to do so. The CLI and the Python package call it for you.
- format_
duration - Formats whole seconds of a duration in the largest exact unit (
90d,36h,45s), the inverse ofparse_duration. - latest_
per_ series - Newest row per series among
batches, orNonewithout a time column or rows. On equal times the later insertion wins, then the later row (later input position), matching dedup’s “latest write wins”. - parse_
duration - Parses durations like
90d,12h,30m,45s,2w,1y, or spelled out (1 day,3 hours).