Skip to main content

Module sql_export

Module sql_export 

Source
Expand description

DuckDB-compatible SQL export for TSDB time-series data.

Generates CREATE TABLE DDL and INSERT DML statements from TSDB metric data so that recordings can be loaded into any SQL engine — including DuckDB, SQLite, or PostgreSQL — without an external dependency.

§Usage

use oxirs_tsdb::analytics::sql_export::{SqlExporter, MetricSchema, DataValueType};

// Describe the schema of a metric.
let schema = MetricSchema::builder("cpu_usage")
    .with_tag("host")
    .with_tag("region")
    .build();

// Generate SQL.
let exporter = SqlExporter::new();
let ddl = exporter.create_table_sql(&schema);
assert!(ddl.contains("CREATE TABLE"));
assert!(ddl.contains("cpu_usage"));

Structs§

MetricSchema
Describes the SQL schema of a TSDB metric.
MetricSchemaBuilder
Fluent builder for MetricSchema.
SqlDataPoint
A single time-series point ready for SQL export.
SqlExporter
Generates SQL DDL and DML statements for TSDB data.

Enums§

DataValueType
The SQL column type used to represent a metric’s value.