Quick start

In about ten minutes: build the timelake command, load a small CSV file of sensor readings, query it, fix a bad reading, and read the same table from Python and DuckDB. Every output below is real.

1. Install

Install the timelake command (macOS and Linux):

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/polythings/timelake/releases/latest/download/timelake-cli-installer.sh | sh

On Windows, in PowerShell:

powershell -ExecutionPolicy Bypass -c "irm https://github.com/polythings/timelake/releases/latest/download/timelake-cli-installer.ps1 | iex"

Or build it with Rust: cargo install timelake-cli. Binaries for each platform are on the releases page.

2. Make some sample data

Two pumps report a temperature and humidity every five minutes. A second file describes the pumps.

mkdir -p ~/timelake-demo && cd ~/timelake-demo
 
cat > readings.csv <<'EOF'
time,device_id,temp,humidity
2026-01-05T10:00:00Z,pump-1,61.2,40
2026-01-05T10:00:00Z,pump-2,58.9,42
2026-01-05T10:05:00Z,pump-1,62.0,41
2026-01-05T10:05:00Z,pump-2,59.4,43
2026-01-05T10:10:00Z,pump-1,63.1,41
2026-01-05T10:10:00Z,pump-2,60.2,44
EOF
 
cat > devices.csv <<'EOF'
device_id,site,model
pump-1,plant-a,XR-200
pump-2,plant-b,XR-300
EOF

3. Choose where tables live

A warehouse is the folder or bucket that holds your tables. Start with a local folder; later the same commands work with s3://bucket/prefix (see Storage).

export TIMELAKE_WAREHOUSE=./warehouse

4. Load the data

import creates a table from the file's columns, then loads the rows. Tell it which column is the time and which column names the device (the series key):

$ timelake import iot.readings readings.csv --time-column time --series-key device_id
created iot.readings
  commit 0: 6 rows, 1 files, 0.0 MB, commit 2 ms [0.0s]
iot.readings: appended 6 rows in 1 commits, 0.01s (566 rows/s) → v2
 
$ timelake import iot.devices devices.csv        # no time column: a plain lookup table
created iot.devices
  commit 0: 2 rows, 1 files, 0.0 MB, commit 1 ms [0.0s]
iot.devices: appended 2 rows in 1 commits, 0.00s (767 rows/s) → v2
 
$ timelake ls
iot.devices
iot.readings

iot is the namespace (a group of tables) and readings the table name. Each load is one commit, which creates a new version of the table (v2).

5. Query it

Average and maximum temperature per pump in 10-minute buckets:

$ timelake sql "SELECT device_id, time_bucket(INTERVAL '10 minutes', time) AS bucket,
                       avg(temp) AS avg_temp, max(temp) AS max_temp
                FROM iot.readings GROUP BY 1, 2 ORDER BY 1, 2"
+-----------+---------------------+----------+----------+
| device_id | bucket              | avg_temp | max_temp |
+-----------+---------------------+----------+----------+
| pump-1    | 2026-01-05T10:00:00 | 61.6     | 62.0     |
| pump-1    | 2026-01-05T10:10:00 | 63.1     | 63.1     |
| pump-2    | 2026-01-05T10:00:00 | 59.15    | 59.4     |
| pump-2    | 2026-01-05T10:10:00 | 60.2     | 60.2     |
+-----------+---------------------+----------+----------+

The newest reading of every pump. This comes from a small index, not a scan of the table:

$ timelake latest iot.readings
+---------------------+-----------+------+----------+
| time                | device_id | temp | humidity |
+---------------------+-----------+------+----------+
| 2026-01-05T10:10:00 | pump-1    | 63.1 | 41       |
| 2026-01-05T10:10:00 | pump-2    | 60.2 | 44       |
+---------------------+-----------+------+----------+

Join readings with the device table, as in any SQL database:

$ timelake sql "SELECT d.site, r.device_id, r.temp
                FROM iot.readings r JOIN iot.devices d USING (device_id)
                WHERE r.time = TIMESTAMP '2026-01-05 10:10:00'"
+---------+-----------+------+
| site    | device_id | temp |
+---------+-----------+------+
| plant-a | pump-1    | 63.1 |
| plant-b | pump-2    | 60.2 |
+---------+-----------+------+

6. Send a correction

Suppose pump-1's 10:10 reading was wrong. Send the corrected value, plus a new reading, as another file. The --batch-id makes the load safe to retry: running it twice loads it once.

$ cat > fix.csv <<'EOF'
time,device_id,temp,humidity
2026-01-05T10:10:00Z,pump-1,63.4,41
2026-01-05T10:15:00Z,pump-1,64.0,40
EOF
 
$ timelake append iot.readings fix.csv --batch-id gateway-7-000001
  commit 0: 2 rows, 1 files, 0.0 MB, commit 5 ms [0.0s]
iot.readings: appended 2 rows in 1 commits, 0.02s (87 rows/s) → v3
$ timelake append iot.readings fix.csv --batch-id gateway-7-000001
  commit 0: 0 rows, 0 files, 0.0 MB, commit 0 ms (duplicate batch, skipped) [0.0s]
iot.readings: appended 0 rows in 0 commits, skipped 1 duplicate batch, 0.02s (0 rows/s) → v3

Both readings for 10:10 are in the table for now. maintain tidies the table: it merges small files and keeps only the last write for each pump and time.

$ timelake maintain iot.readings
iot.readings: compacted 1 partitions (2 → 1 files, 8 rows, 1 duplicates removed, 0.0 MB read), … → v4
 
$ timelake sql "SELECT * FROM iot.readings WHERE device_id = 'pump-1' ORDER BY time"
+---------------------+-----------+------+----------+
| time                | device_id | temp | humidity |
+---------------------+-----------+------+----------+
| 2026-01-05T10:00:00 | pump-1    | 61.2 | 40       |
| 2026-01-05T10:05:00 | pump-1    | 62.0 | 41       |
| 2026-01-05T10:10:00 | pump-1    | 63.4 | 41       |
| 2026-01-05T10:15:00 | pump-1    | 64.0 | 40       |
+---------------------+-----------+------+----------+

You rarely need to run maintain yourself: every append already does the cheap part of this work. Run it on a schedule (cron, a Lambda) if you want each day's data in one sorted file and duplicates gone quickly.

7. Look at the table

$ timelake info iot.readings
table      iot.readings (v4, Iceberg v2)
time       time (chunk day)
series key device_id
dedup      true
inserted   _ingest_ts
retention  forever
schema     time Timestamp(µs), device_id Utf8, temp Float64, humidity Int64, _ingest_ts Timestamp(µs, "+00:00")
data       7 rows in 1 files, 0.0 MB
…

The table is a folder of ordinary files: Parquet for the data, Apache Iceberg metadata to list them. How it works explains each file.

8. The same from Python

Install the Python package into a virtual environment in the demo folder, then write and read with pyarrow:

cd ~/timelake-demo
uv venv && uv pip install timelake pyarrow
source .venv/bin/activate && python
import datetime as dt
 
import pyarrow as pa
import timelake
 
lake = timelake.Lake("./warehouse")
 
# A new table, created from a pyarrow schema
schema = pa.schema([
    ("time", pa.timestamp("us", tz="UTC")),
    ("device_id", pa.string()),
    ("temp", pa.float64()),
])
t = lake.create_table("iot.py_readings", schema, time_column="time", series_key=["device_id"])
 
t0 = dt.datetime(2026, 1, 5, 10, 0, tzinfo=dt.timezone.utc)
batch = pa.table(
    {"time": [t0, t0, t0 + dt.timedelta(minutes=5)], "device_id": ["pump-1", "pump-2", "pump-1"], "temp": [61.2, 58.9, 62.0]},
    schema=schema,
)
print(t.append(batch, batch_id="gateway-7-000001"))
# {'rows': 3, 'files': 1, 'bytes': 1804, 'version': 2, 'commit_ms': 6.8, 'attempts': 1, 'duplicate': False}
 
print(lake.sql("SELECT device_id, avg(temp) AS avg_temp FROM iot.py_readings GROUP BY 1 ORDER BY 1").to_pylist())
# [{'device_id': 'pump-1', 'avg_temp': 61.6}, {'device_id': 'pump-2', 'avg_temp': 58.9}]
 
print(lake.latest("iot.readings").to_pylist())   # the table loaded by the CLI above

Results come back as pyarrow.Table; call .to_pandas() or polars.from_arrow(…) if you prefer those. All methods are listed in the Python API.

9. Read it from DuckDB

Other tools read the table without Timelake. In DuckDB:

INSTALL iceberg; LOAD iceberg;
SELECT device_id, count(*), max(temp)
FROM iceberg_scan('warehouse/iot/readings')
GROUP BY 1 ORDER BY 1;
 
┌───────────┬──────────────┬─────────────┐
│ device_id │ count_star() │ max("temp") │
├───────────┼──────────────┼─────────────┤
│ pump-1    │            4 │        64.0 │
│ pump-2    │            3 │        60.2 │
└───────────┴──────────────┴─────────────┘

timelake duckdb iot.readings prints this SQL for any table, plus the location of its latest-values index.

10. Move to object storage

Point the warehouse at a bucket. Credentials come from the usual AWS_* environment variables. For a profile or an SSO login, export its credentials first with eval "$(aws configure export-credentials --format env)":

export TIMELAKE_WAREHOUSE=s3://my-bucket/lake
export AWS_REGION=us-east-2
timelake import iot.readings readings.csv --time-column time --series-key device_id

For MinIO and other S3-compatible stores, see Storage & configuration.

Ingestion setups

The guides below set up continuous ingestion on one platform each, with several designs per platform and a recommendation for which to start with. Every design appends to the same iot.readings table as above.

Platforms

GuideTables inAppends run inDevices send throughStorage tested
Locala foldercron, or your own programfiles in a folderyes
AWSS3LambdaS3, Kinesis, SQS, IoT Core, or Firehoseyes
AzureBlob StorageAzure FunctionsBlob Storage, Event Hubs, Service Bus, or IoT Hubnot yet
Google CloudCloud StorageCloud Run functionsCloud Storage or Pub/Subnot yet
CloudflareR2a consumer Worker, or a writer on any hostR2 or Queuesnot yet
Fly.ioTigrisa Fly app that stays runningHTTPS, MQTT, or Tigris uploadsperformance only
VercelTigris, S3, or R2Vercel Functions and Cron JobsHTTPS, Vercel Queues, or bucket uploadsdepends on the store
TigrisTigrisanywhereTigris uploads, or your own processperformance only

"Storage tested" is from Limitations: Timelake's correctness tests run on local disk and AWS S3. Its performance has been measured on Tigris. Azure, Google Cloud, and R2 use the same storage library but haven't been tested yet.

Designs

The same few designs appear on every platform, under different service names:

DesignFits
Files, appended on uploadgateways that buffer readings and upload a file every few minutes
Stream or queue, in batchesdevices that send readings one at a time
Platform batches into filesmany small senders, when a minute or more of delay is fine
MQTTdevices that already speak MQTT
HTTP intakedevices or gateways that POST over HTTPS
Scheduled checksalerts on recent data
DesignAWSAzureGoogle Cloud
Files, appended on uploadS3 + LambdaBlob Storage + Event GridCloud Storage + Eventarc
Stream or queue, in batchesKinesis or SQSEvent Hubs or Service BusPub/Sub, pulled
Platform batches into filesFirehoseEvent Hubs Capture (outline)Pub/Sub to Cloud Storage
MQTTIoT CoreIoT Hubyour own broker (outline)
HTTP intakeAPI Gateway + SQS (outline)Service Bus over HTTPS (outline)—
Scheduled checksEventBridge + Lambdaa timer functionCloud Scheduler
DesignCloudflareFly.ioVercel
Files, appended on uploadR2 notificationsTigris notificationsa Cron Job polls
Stream or queue, in batchesQueues + a consumer Worker or pulled—Vercel Queues
Platform batches into files———
MQTT—an MQTT worker—
HTTP intakea Workerthe app itselfa function
Scheduled checkscronthe jobs processa Cron Job

Which to choose

  • Your platform decides first. Use the guide for the cloud your devices and team already use: credentials, networking, and billing are already in place.
  • Then how devices send. If gateways can buffer readings into files, start with files to a bucket: it has the fewest moving parts, and each file becomes one commit with its name as the batch id. If devices send one reading at a time, put a stream or queue in front and append in batches. Without an account yet, start with Local.
  • Batch to about one commit every 10 seconds to a minute. Each commit costs about 9 storage requests, and commits to one table happen one at a time. Upload intervals, batching windows, and flush intervals are the settings that control this.
  • For storage Timelake has been tested on, use AWS S3 or local disk. On Tigris, create the lake bucket single-region or multi-region: on the default global type, conditional writes are checked within one region only.
  • For a web app or HTTPS devices without a cloud provider, use Fly.io (an app that stays running) or Vercel (functions and cron), both with Tigris as the store.

Every design uses the same Timelake pieces: one commit per append, a batch id where the input has a stable name, deduplication for the rest, a few concurrent writers at most, and an hourly maintain.

Next steps

  • How it works: what happens on a write and a read.
  • Querying: time buckets, latest values, and which queries are fastest.
  • Settings: partition size, retention, deduplication, and every other switch.