New version with grafana
This commit is contained in:
parent
f86ad9a542
commit
b2f649a489
6 changed files with 201 additions and 21 deletions
|
|
@ -93,11 +93,15 @@ async def init_db_async():
|
|||
# Enable TimescaleDB extension and convert telemetry_events to hypertable
|
||||
# Use a transactional context to ensure DDL statements are committed
|
||||
with engine.begin() as conn:
|
||||
# Enable TimescaleDB extension (may already exist)
|
||||
# Enable or update TimescaleDB extension
|
||||
try:
|
||||
conn.execute(text("CREATE EXTENSION IF NOT EXISTS timescaledb"))
|
||||
except Exception as e:
|
||||
print(f"Warning: failed to create extension timescaledb: {e}")
|
||||
try:
|
||||
conn.execute(text("ALTER EXTENSION timescaledb UPDATE"))
|
||||
except Exception as e:
|
||||
print(f"Warning: failed to update timescaledb extension: {e}")
|
||||
# Create hypertable for telemetry_events, skip default indexes to avoid collisions
|
||||
try:
|
||||
conn.execute(text(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue