Skip to content

Query DuckLake with SQL

This guide shows you how to query the DuckLake telemetry tables directly with DuckDB SQL. canardstack does not expose SQL through its HTTP API.

INSTALL ducklake;
LOAD ducklake;
ATTACH 'ducklake:/path/to/catalog.ducklake' AS canardlake
(DATA_PATH '/path/to/ducklake-data');
USE canardlake;

For MotherDuck-backed DuckLake:

Terminal window
export MOTHERDUCK_TOKEN='<your-motherduck-token>'
duckdb
ATTACH 'md:test-ducklake' AS canardlake;
USE canardlake;
SELECT time_unix_nano, service_name, severity_text, body
FROM otlp_logs
WHERE time_unix_nano >= now() - INTERVAL 1 HOUR
ORDER BY time_unix_nano DESC
LIMIT 100;
SELECT start_time_unix_nano, trace_id, span_id, service_name, name,
duration_time_unix_nano
FROM otlp_traces
WHERE start_time_unix_nano >= now() - INTERVAL 1 HOUR
ORDER BY start_time_unix_nano DESC
LIMIT 100;
SELECT time_unix_nano, name, service_name,
coalesce(double_value, int_value::DOUBLE) AS value
FROM otlp_metrics_gauge
WHERE time_unix_nano >= now() - INTERVAL 1 HOUR
ORDER BY time_unix_nano DESC
LIMIT 100;

Keep direct SQL bounded with event-time predicates, LIMIT, and selected columns.