Lightweight Python library and helper script to upload CSV/Excel data and JSON metadata to the Open Energy Platform (OEP). No FastAPI frontend; no maintained CLI argument interface—use the batch script or the programmatic API.
- Programmatic uploader via
OepUploader; batch helper scriptmain.py - Automatic schema creation with primary-key support and type inference
- CSV separator detection (
,,;, tab) and Excel support (.xlsx/.xls) - Table handling: optional delete/overwrite of existing tables
- Sample datasets under
data/andexamples/for quick testing
- Python 3.8+
- Install dependencies:
pip install -r requirements.txt- Set OEP API token (get a token):
# macOS/Linux
export OEP_API_TOKEN="your-token-here"
# Windows (CMD)
set OEP_API_TOKEN=your-token-here
# Windows (PowerShell)
$env:OEP_API_TOKEN="your-token-here"Run from the repo root; the script scans data/ for .json metadata files and uploads the matching .csv files to the configured topic (defaults to sandbox).
pip install -r requirements.txt
export OEP_API_TOKEN="your-token-here"
python main.pyAdjust TOPIC, AUTOMATIC_SCAN, and delete_existing directly in main.py as needed.
from src.oep.uploader import OepUploader
# Ensure PYTHONPATH=src if the package is not installed
uploader = OepUploader(topic="sandbox")
df = uploader.read_data("data/demand/ghd_east.csv")
uploader.upload_complete(
data_file="data/demand/ghd_east.csv",
metadata_file="data/demand/ghd_east.json",
table_name="my_table",
primary_key="id",
delete_existing=True,
)oep-api/
├── src/oep/uploader.py # OepUploader class
├── main.py # Helper script for batch upload from data/
├── data/ # Sample data (CSV + JSON)
├── examples/ # Additional sample files
├── OEP_UPLOADER_README.md # Detailed CLI docs (DE)
├── requirements.txt # Dependencies
└── README.md
OEP_UPLOADER_README.md– detailed CLI reference with argument table (DE)
- "OEP API token not found": set
OEP_API_TOKENor provide via--token. - "Table already exists": use
delete_existing=Truein code or remove the table first. - "Data/Metadata file not found": verify paths; CSV/JSON must exist.
- CSV parsing off: check separator; the tool tries
,,;, tab in order.
- Test first in the
sandboxtopic; use productive schemas carefully. - For Excel uploads install
openpyxl. - For scripts, ensure
oep-clientis installed andPYTHONPATH=srcis set if the package is not installed.