---
title: Driver Support
description: Supported database backends for ROSQL — PostgreSQL, MySQL, DuckDB, and more
sidebar_position: 2
keywords: [rosql, postgresql, mysql, duckdb, database, driver, backend]
---

# Driver Support

ROSQL compiles to SQL and other database languages and executes against your existing telemetry database. Each backend is enabled via a Cargo feature flag.

## Supported backends

| Backend | Feature flag | Status |
|---------|-------------|--------|
| PostgreSQL / TimescaleDB | `postgres` | ✅ v0.1 |
| MySQL / MariaDB | `mysql` | ✅ v0.1 |
| DuckDB (embedded) | `duckdb` | ✅ v0.2 |
| AWS Athena | `athena` | 📋 [Planned](https://github.com/RobotOpsInc/rosql/issues/9) |
| Google BigQuery | `bigquery` | 📋 [Planned](https://github.com/RobotOpsInc/rosql/issues/10) |

## Feature flags

| Feature | What it enables | Runtime deps |
|---------|----------------|-------------|
| *(default)* | Parser, AST, unit system, SQL compiler, proto types | logos, serde, prost |
| `postgres` | PostgreSQL / TimescaleDB driver | sqlx, tokio |
| `mysql` | MySQL / MariaDB driver | sqlx, tokio |
| `duckdb` | DuckDB embedded driver | duckdb (bundled), tokio |
| `server` | `rosql` CLI binary + gRPC server | tonic, tokio, clap |
| `wasm` | WASM exports for browser editors | wasm-bindgen |

## Installing with a specific backend

```bash
# PostgreSQL driver + CLI
cargo install rosql --features server,postgres

# MySQL driver + CLI
cargo install rosql --features server,mysql

# DuckDB driver + CLI (no external database required)
cargo install rosql --features server,duckdb

# Multiple drivers
cargo install rosql --features server,postgres,mysql,duckdb

# Library only (no CLI, no runtime)
cargo add rosql
```

## Connection strings

### PostgreSQL / TimescaleDB

```bash
rosql query "FROM traces WHERE status = 'ERROR'" \
  --backend postgres \
  --url postgresql://user:pass@localhost:5432/telemetry
```

Connection string format: `postgresql://[user[:password]@][host][:port]/database`

TimescaleDB is fully supported — ROSQL uses standard PostgreSQL queries that work transparently with hypertables.

### MySQL / MariaDB

```bash
rosql query "FROM traces WHERE status = 'ERROR'" \
  --backend mysql \
  --url mysql://user:pass@localhost:3306/telemetry
```

Connection string format: `mysql://[user[:password]@][host][:port]/database`

### DuckDB

DuckDB runs embedded — no external server required. The database is compiled into the binary.

```bash
# In-memory database (data is lost when the process exits)
rosql query "FROM traces WHERE status = 'ERROR'" \
  --backend duckdb \
  --url duckdb://

# File-based persistent database
rosql query "FROM traces WHERE status = 'ERROR'" \
  --backend duckdb \
  --url duckdb:///path/to/telemetry.db
```

Connection string formats:
- `duckdb://` — in-memory database
- `duckdb:///absolute/path/to/file.db` — file-based database
- `md:my_database` — [MotherDuck](https://motherduck.com) (cloud DuckDB)

DuckDB is particularly useful for:
- **Local analytics** on MCAP/bag files converted to Parquet
- **CI/testing** — no Docker or external service required
- **Offline environments** where a database server is unavailable
- **Embedded robotics systems** with local telemetry storage

## Schema profiles

Different OTel Collector exporters use different column naming conventions. Select the profile matching your exporter:

| Profile | Column convention | Example | Default for |
|---------|------------------|---------|-------------|
| `otel-postgres` | lowercase | `trace_id`, `status_code` | PostgreSQL, MySQL |
| `otel-clickhouse` | PascalCase | `TraceId`, `StatusCode` | ClickHouse |

```bash
# Explicit schema profile
rosql compile "FROM traces WHERE status = 'ERROR'" \
  --backend postgres \
  --schema otel-postgres

rosql compile "FROM traces WHERE status = 'ERROR'" \
  --backend clickhouse \
  --schema otel-clickhouse
```

If your column names don't match either profile, custom schema profiles are tracked in [#22](https://github.com/RobotOpsInc/rosql/issues/22).

## Schema requirements

Your database must have the OTel tables ROSQL expects. See the [Schema Reference →](./schema-reference) for complete DDL.

Required tables for basic functionality:
- `otel_traces`
- `otel_logs`
- `otel_metrics`

Optional tables for advanced features:
- `topic_messages` — enables `FROM topics`, `PATH DEVIATION`, topic aliases
- `mcap_metadata` — enables `SHOW RECORDING`
