-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmaterialize_bridge.py
More file actions
27 lines (21 loc) · 897 Bytes
/
materialize_bridge.py
File metadata and controls
27 lines (21 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import duckdb
print('[*] Initiating DuckDB Materialized Bridge...')
con = duckdb.connect()
# Load native extensions
con.execute('INSTALL postgres; LOAD postgres;')
# DuckDB attaches to the local Postgres daemon
print('[*] Attaching to local Postgres daemon...')
con.execute("ATTACH 'host=127.0.0.1 port=5432 user=postgres password=postgres dbname=quanux' AS pg (TYPE postgres);")
# Create the schema and push the telemetry Parquet data natively into Postgres
print('[*] Forging the Supergraph table...')
con.execute("""
CREATE TABLE IF NOT EXISTS pg.quanux_telemetry_live (
timestamp TIMESTAMP,
cpu_usage DOUBLE,
memory_usage DOUBLE,
latency_ns BIGINT
);
""")
# Seed the matrix for the FastMCP ping
con.execute("INSERT INTO pg.quanux_telemetry_live VALUES (now(), 45.2, 60.1, 150000);")
print('[+] Materialization Complete. The Oracle is breathing.')