Energy database: hierarchy + series metadata on Postgres, bitemporal I/O via timedb
Project description
⚡ EnergyDB
Persistent storage for energy portfolios — assets, grid topology, and bitemporal time series, in one connected database.
EnergyDB extends TimeDB with persistent storage for EnergyDataModel hierarchies — portfolios, sites, and assets — links them to bitemporal time series with full auditability, and models grid topology via typed edges. Round-trip a portfolio between Python and Postgres without losing identity: every Element keeps its UUID end-to-end.
Most time-series systems are agnostic about what their series represent. EnergyDB knows it is a portfolio: assets, sites, and grid topology, with the bitemporal series that describe them living alongside.
🏗️ The Connected Portfolio Model
EnergyDB stores three kinds of objects in one connected database:
| Layer | Description | Real-World Example |
|---|---|---|
| 🌳 Hierarchy | Arbitrary-depth tree of portfolios, sites, and assets | "Offshore-1 → WindTurbine T01 → power" |
| 🔗 Topology | Typed edges (Line, Link, Pipe) connect any two nodes | "Cable-1: BusA → BusB" |
| ⏱️ Bitemporal series | Forecast revisions and audit trails — owned by a node or edge | "power_flow on Cable-1, valid Wed 12:00, known Mon 18:00" |
Identity & Round-Trip: Every
Elementcarries a UUID7. Read → modify → write back works in place — renames, moves, and property edits become silentUPDATEs.
✨ Why Choose EnergyDB?
- 🌳 Asset hierarchies: Declare your portfolio in Python (EnergyDataModel) and persist arbitrary depth in one call.
- 🔗 Grid topology: Typed edges for lines, links, pipes — with their own time series and endpoint navigation.
- 🔁 Round-trip persistence: UUID identity from in-memory
Elementto Postgres row PK; no delete-then-insert dance. - ⏱️ Bitemporal series: Forecast revisions, corrections, and time-of-knowledge queries powered by TimeDB.
- 🧭 Fluent, lazy navigation:
client.get_node("Portfolio", "Site", "T01").read(...)resolves to one indexed CTE.
🚀 Quick Start
1. Installation
pip install energydb
Requires Python 3.12+, PostgreSQL (asset hierarchy + series catalog), and ClickHouse (time-series values).
2. Usage Example
from datetime import UTC, datetime
import energydb as edb
import pandas as pd
client = edb.Client() # reads TIMEDB_PG_DSN / TIMEDB_CH_URL from env
client.create() # PG schema + CH series_values table
# 1. Declare a turbine and the series it will hold (metadata only).
t01 = edb.wind.WindTurbine(
name="T01", lat=55.01, lon=3.02, capacity=3.5, hub_height=80,
timeseries=[
edb.TimeSeries(name="power", unit="MW",
data_type=edb.DataType.ACTUAL),
],
)
# 2. Wrap it in a site and a portfolio.
site = edb.Site(name="Offshore-1", lat=55.0, lon=3.0, members=[t01])
portfolio = edb.Portfolio(name="my-portfolio", members=[site])
# 3. Persist structure (nodes, edges, series declarations). Idempotent.
client.register_tree(portfolio)
# 4. Write a day of hourly values for the turbine's power series.
start = datetime(2026, 1, 1, tzinfo=UTC)
df = pd.DataFrame({
"valid_time": pd.date_range(start, periods=24, freq="1h", tz="UTC"),
"value": [2.5 + 0.05 * i for i in range(24)],
})
client.get_node("my-portfolio", "Offshore-1", "T01").write(
df, name="power", data_type="actual",
)
# 5. Read back — single asset, or across the whole portfolio.
client.get_node("my-portfolio", "Offshore-1", "T01").read(name="power", data_type="actual")
client.get_node("my-portfolio").read(name="power", data_type="actual")
# 6. Reconstruct the full EDM tree from the database.
tree = client.get_tree("my-portfolio", include_series=True)
🧪 Try it in Google Colab
Want to try EnergyDB 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
📦 Related Projects
| Project | Description |
|---|---|
| TimeDB | Bitemporal time-series database with auditability and overlapping-forecast support |
| TimeDataModel | Pythonic data model for time series |
| EnergyDataModel | Data model for energy assets (solar, wind, battery, grid, ...) |
🤝 Contributing
Contributions are welcome! If you're interested in improving EnergyDB, 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 energydb-0.3.3.tar.gz.
File metadata
- Download URL: energydb-0.3.3.tar.gz
- Upload date:
- Size: 59.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1d6c80ddbf6960f1fcdf53e12d8944c0f72965b32c8029a34a917cf5f37a2d1
|
|
| MD5 |
b06ce76d01079991dcd25be20b734d0d
|
|
| BLAKE2b-256 |
54c31f6b193312fec299c95966b490e312557bb06e5876ed22ddc921254f3423
|
Provenance
The following attestation bundles were made for energydb-0.3.3.tar.gz:
Publisher:
publish.yml on rebase-energy/energydb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
energydb-0.3.3.tar.gz -
Subject digest:
b1d6c80ddbf6960f1fcdf53e12d8944c0f72965b32c8029a34a917cf5f37a2d1 - Sigstore transparency entry: 1449593191
- Sigstore integration time:
-
Permalink:
rebase-energy/energydb@bf3d902e81d4d7994153f0e3a7b02ada33b35098 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/rebase-energy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bf3d902e81d4d7994153f0e3a7b02ada33b35098 -
Trigger Event:
release
-
Statement type:
File details
Details for the file energydb-0.3.3-py3-none-any.whl.
File metadata
- Download URL: energydb-0.3.3-py3-none-any.whl
- Upload date:
- Size: 44.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 |
c61f78205c7c8f4f90a9b072021aa5e6e2646457ef826aa805c176984fa9eab7
|
|
| MD5 |
0544b632bb50c9f85d2be80d08aa4b5f
|
|
| BLAKE2b-256 |
6057ee07670e901258622bd92b01b6047f1368e49a868b77050087d83338ca54
|
Provenance
The following attestation bundles were made for energydb-0.3.3-py3-none-any.whl:
Publisher:
publish.yml on rebase-energy/energydb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
energydb-0.3.3-py3-none-any.whl -
Subject digest:
c61f78205c7c8f4f90a9b072021aa5e6e2646457ef826aa805c176984fa9eab7 - Sigstore transparency entry: 1449593211
- Sigstore integration time:
-
Permalink:
rebase-energy/energydb@bf3d902e81d4d7994153f0e3a7b02ada33b35098 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/rebase-energy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bf3d902e81d4d7994153f0e3a7b02ada33b35098 -
Trigger Event:
release
-
Statement type: