Minimal stateless ClickHouse library for bitemporal time series
Project description
TimeDB is designed to natively handle overlapping forecast revisions, auditable human-in-the-loop updates, and "time-of-knowledge" history. Using a three-dimensional temporal data model, it provides a seamless workflow through its Python SDK and FastAPI backend.
Traditional time-series databases assume one immutable value per timestamp. TimeDB is built for complex, real-world domains where forecasts evolve, data gets corrected, and historical backtesting requires strict audits.
🧊 The 3D Temporal Data Model
At the heart of TimeDB is its three-dimensional approach to time. We track not just when data is valid, but when it became known and when it was altered.
| Dimension | Description | Real-World Example |
|---|---|---|
📅 valid_time |
The time the value represents a fact for. | "Wind speed forecast for Wednesday 12:00" |
⏰ knowledge_time |
The time when the value was predicted/known. | "Generated on Monday 18:00" |
✏️ change_time |
The time when the value was written or changed. | "Manually overridden on Tuesday 09:00" |
Audit & Metadata: Every data point also supports
tags,annotations, andchanged_byto maintain a perfect audit trail of who changed what, when, and why.
✨ Why Choose TimeDB?
- 📊 Forecast Revisions: Store overlapping forecasts with full provenance.
- 🔄 Auditable Updates: Manual adjustments generate audit trails, not silent overwrites.
- ⏪ True Backtesting: Query historical data as of any point in time ("What did our model know last Monday?").
- 🏷️ Label-Based Organization: Easily filter and slice series by meaningful dimensions.
🚀 Quick Start
1. Installation
pip install timedb
Requires Python 3.9+, PostgreSQL (series metadata), and ClickHouse (time-series values).
2. Usage Example
import timedb as td
import pandas as pd
from datetime import datetime, timezone
from timedb import TimeSeries
# Create Schema
td.create()
# 1. Create a forecast series
td.create_series(
name="wind_power",
unit="MW",
labels={"site": "offshore_1"},
overlapping=True
)
# 2. Insert forecast with knowledge_time
knowledge_time = datetime(2025, 1, 1, 18, 0, tzinfo=timezone.utc)
ts = TimeSeries.from_pandas(
pd.DataFrame({
'valid_time': pd.date_range('2025-01-01', periods=24, freq='h', tz='UTC'),
'value': [100 + i*2 for i in range(24)]
}),
unit='MW',
)
td.get_series("wind_power") \
.where(site="offshore_1") \
.insert(ts, knowledge_time=knowledge_time)
# 3. Read latest forecast — returns a TimeSeries
ts_latest = td.get_series("wind_power").where(site="offshore_1").read()
df_latest = ts_latest.to_pandas() # pd.DataFrame with valid_time index
# 4. Read forecast history (one row per knowledge_time × valid_time)
ts_all = td.get_series("wind_power").where(site="offshore_1").read(overlapping=True)
🧪 Try it in Google Colab
Want to try TimeDB without a local setup? Open our Quickstart in Colab — the first cell automatically installs PostgreSQL + ClickHouse inside the VM.
Note: Data persists only within the active Colab session. Additional notebooks are available in the
examples/directory.
📚 Documentation & Resources
- 📖 Official Documentation
- ⚙️ Installation Guide
- 🐍 Python SDK Documentation
- 🌐 Reference
- 💡 Examples & Notebooks
🤝 Contributing
Contributions are welcome! If you're interested in improving TimeDB, please see our Development Guide for local setup instructions.
Licensed under the Apache-2.0 License.
Find a bug or have a feature request? Open an Issue.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file timedb-0.2.0.tar.gz.
File metadata
- Download URL: timedb-0.2.0.tar.gz
- Upload date:
- Size: 21.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a6bdda5a1db4663ff6860b972c83a534b4c07adecd9a3847bfe9c1cb6e055aa
|
|
| MD5 |
38f305f4127230d68068afa1be39cded
|
|
| BLAKE2b-256 |
99a8a2c71bb7e7852bceb3ec60c31085a0e97cd95632693e050f7db79c9d760f
|
Provenance
The following attestation bundles were made for timedb-0.2.0.tar.gz:
Publisher:
publish.yml on rebase-energy/timedb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
timedb-0.2.0.tar.gz -
Subject digest:
1a6bdda5a1db4663ff6860b972c83a534b4c07adecd9a3847bfe9c1cb6e055aa - Sigstore transparency entry: 1440042005
- Sigstore integration time:
-
Permalink:
rebase-energy/timedb@90220c71076cf7ddfc021513de3c3ba33e21f7f5 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/rebase-energy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@90220c71076cf7ddfc021513de3c3ba33e21f7f5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file timedb-0.2.0-py3-none-any.whl.
File metadata
- Download URL: timedb-0.2.0-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e72066b4947e3549658b1a44df3b0227f960e6ec3236c8128db04de5c62a3743
|
|
| MD5 |
86304b7b9c09507102bc166118cef3f8
|
|
| BLAKE2b-256 |
8d8862a955c52bec6ac0e965f7eeae9d53464fcb81c9a23e15b0f5513e376801
|
Provenance
The following attestation bundles were made for timedb-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on rebase-energy/timedb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
timedb-0.2.0-py3-none-any.whl -
Subject digest:
e72066b4947e3549658b1a44df3b0227f960e6ec3236c8128db04de5c62a3743 - Sigstore transparency entry: 1440042014
- Sigstore integration time:
-
Permalink:
rebase-energy/timedb@90220c71076cf7ddfc021513de3c3ba33e21f7f5 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/rebase-energy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@90220c71076cf7ddfc021513de3c3ba33e21f7f5 -
Trigger Event:
release
-
Statement type: