timedb — opinionated schema & API for time series
Project description
TimeDB
TimeDB is an open source, opinionated time series database built on PostgreSQL and TimescaleDB designed to natively handle overlapping forecast revisions, auditable human-in-the-loop updates, and "time-of-knowledge" history through a three-dimensional temporal data model. TimeDB provides a seamless workflow through its Python SDK and FastAPI backend.
Features
- Time-of-Knowledge History: Track not just when data is valid, but when it became known
- Forecast Revisions: Store overlapping forecasts with full provenance
- Auditable Updates: Every change records who, what, when, and why
- Backtesting Ready: Query historical data as of any point in time
- Label-Based Organization: Filter series by meaningful dimensions
Why timedb?
Traditional time series databases assume one immutable value per timestamp. TimeDB is built for domains where:
- 📊 Forecasts evolve: Multiple predictions for the same timestamp from different times
- 🔄 Data gets corrected: Manual adjustments need audit trails, not overwrites
- ⏪ Backtesting requires history: "What did we know on Monday?" vs "what do we know now?"
- ✏️ Humans review data: Track who changed what, when, and why
Quick Start
pip install timedb
import timedb as td
import pandas as pd
from datetime import datetime, timezone
td.create()
# Create a forecast series
td.create_series(name="wind_power", unit="MW",
labels={"site": "offshore_1"}, overlapping=True)
# Insert forecast with knowledge_time
knowledge_time = datetime(2025, 1, 1, 18, 0, tzinfo=timezone.utc)
df = 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)]
})
td.get_series("wind_power").where(site="offshore_1").insert(df=df, knowledge_time=knowledge_time)
# Read latest forecast
df_latest = td.get_series("wind_power").where(site="offshore_1").read()
# Read all forecast revisions
df_all = td.get_series("wind_power").where(site="offshore_1").read(versions=True)
For custom connection settings (host, pool size, etc.), use
TimeDataClientdirectly:from timedb import TimeDataClient; td = TimeDataClient(conninfo="postgresql://...")
Try in Google Colab
Try the quickstart in Colab — no local setup required. The first cell installs PostgreSQL + TimescaleDB automatically inside the Colab VM (~2 min).
Additional notebooks and Google Colab links are available in the examples directory.
Note: The Colab setup cell installs PostgreSQL 14 + TimescaleDB. Data persists only within the active Colab session.
Documentation
Data Model
Three time dimensions:
| Dimension | Description | 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 known | "Wind speed forecast for Wednesday 12:00 was generated on Monday 18:00" |
| change_time | The time when the value was changed | "Wind speed forecast for Wednesday 12:00 was manually changed on Tuesday 9:00" |
Plus metadata: tags, annotation, changed_by, change_time for audit trails.
Requirements
- Python 3.9+
- PostgreSQL 12+ with TimescaleDB
- (Optional) Jupyter for notebooks
Contributing
Contributions welcome! See DEVELOPMENT.md for setup instructions.
Contributors
License
Apache-2.0
See Also
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.1.2.tar.gz.
File metadata
- Download URL: timedb-0.1.2.tar.gz
- Upload date:
- Size: 44.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f817139a62ed6d7a1ac8e4388107207063a16988390c5bde810bbf091ec69e14
|
|
| MD5 |
51d41e221d81b7eabdc7ac5526cc773d
|
|
| BLAKE2b-256 |
9e2cf13feb4519dd9318e8b49e25bdac54fed550e5f3965fce87a4d4872d41e7
|
Provenance
The following attestation bundles were made for timedb-0.1.2.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.1.2.tar.gz -
Subject digest:
f817139a62ed6d7a1ac8e4388107207063a16988390c5bde810bbf091ec69e14 - Sigstore transparency entry: 973396588
- Sigstore integration time:
-
Permalink:
rebase-energy/timedb@42c6f4416756f1e6d0ba3e4665332876e49235d7 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/rebase-energy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@42c6f4416756f1e6d0ba3e4665332876e49235d7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file timedb-0.1.2-py3-none-any.whl.
File metadata
- Download URL: timedb-0.1.2-py3-none-any.whl
- Upload date:
- Size: 42.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9eb3153294c0816bf65cb8c40d7502cdc809261386122246d940592905a22333
|
|
| MD5 |
ecd986db94008f90c14a5f107c3dc634
|
|
| BLAKE2b-256 |
ee4fd13fec9786b7a879ce2b21a5077d4ffa66b11c9a807114d7fc175993973f
|
Provenance
The following attestation bundles were made for timedb-0.1.2-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.1.2-py3-none-any.whl -
Subject digest:
9eb3153294c0816bf65cb8c40d7502cdc809261386122246d940592905a22333 - Sigstore transparency entry: 973396595
- Sigstore integration time:
-
Permalink:
rebase-energy/timedb@42c6f4416756f1e6d0ba3e4665332876e49235d7 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/rebase-energy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@42c6f4416756f1e6d0ba3e4665332876e49235d7 -
Trigger Event:
release
-
Statement type: