Read Databento DBN (Databento Binary Encoding) market-data files, including Zstd-compressed .dbn.zst captures, directly as SQL tables
Installing and Loading
INSTALL dbn FROM community;
LOAD dbn;
Example
-- Inspect a DBN file (works on .dbn and .dbn.zst)
SELECT * FROM dbn_metadata('XNAS-20240101.trades.dbn.zst');
-- Query a schema-specific reader
SELECT ts_event, instrument_id, price, size, side
FROM read_dbn_trades('XNAS-20240101.trades.dbn.zst')
WHERE side = 'B'
ORDER BY ts_event
LIMIT 10;
-- Polymorphic reader dispatches on the file's metadata.schema
SELECT count(*) FROM read_dbn('capture.dbn.zst');
-- Globs read many files in order as one table
SELECT * FROM read_dbn_mbp1('data/2024-01-*.mbp-1.dbn.zst');
About dbn
The dbn extension reads Databento DBN
(Databento Binary Encoding) files directly as SQL tables — no conversion
step and no Python. It supports every DBN market-data schema (trades, mbo,
mbp-1/mbp-10, tbbo, bbo/cbbo/cmbp-1/tcbbo, ohlcv, status, imbalance,
statistics, definition), DBN versions 1–3, and transparent Zstd
decompression of the .dbn.zst captures Databento ships.
Each schema has a dedicated reader (read_dbn_trades, read_dbn_mbo, …),
plus a polymorphic read_dbn(path) that dispatches on the file's metadata,
dbn_metadata(path) for file inspection, and dbn_records(path) for raw
record access. Filter and projection pushdown run inside the scan, all
ts_* columns are TIMESTAMP_NS, and DBN "undefined" sentinels are
surfaced as SQL NULL. For live captures, symbols := true resolves
instrument_id to its raw symbol inline.
Decoding is differentially verified bit-identical to the official
databento Python decoder across every schema and DBN version. This is an
independent reader, not affiliated with Databento.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| dbn_metadata | table | NULL | NULL | |
| dbn_records | table | NULL | NULL | |
| read_dbn | table | NULL | NULL | |
| read_dbn_bbo_1m | table | NULL | NULL | |
| read_dbn_bbo_1s | table | NULL | NULL | |
| read_dbn_cbbo_1m | table | NULL | NULL | |
| read_dbn_cbbo_1s | table | NULL | NULL | |
| read_dbn_cmbp1 | table | NULL | NULL | |
| read_dbn_definition | table | NULL | NULL | |
| read_dbn_imbalance | table | NULL | NULL | |
| read_dbn_mbo | table | NULL | NULL | |
| read_dbn_mbp1 | table | NULL | NULL | |
| read_dbn_mbp10 | table | NULL | NULL | |
| read_dbn_ohlcv_1d | table | NULL | NULL | |
| read_dbn_ohlcv_1h | table | NULL | NULL | |
| read_dbn_ohlcv_1m | table | NULL | NULL | |
| read_dbn_ohlcv_1s | table | NULL | NULL | |
| read_dbn_ohlcv_eod | table | NULL | NULL | |
| read_dbn_statistics | table | NULL | NULL | |
| read_dbn_status | table | NULL | NULL | |
| read_dbn_symbol_mapping | table | NULL | NULL | |
| read_dbn_system | table | NULL | NULL | |
| read_dbn_tbbo | table | NULL | NULL | |
| read_dbn_tcbbo | table | NULL | NULL | |
| read_dbn_trades | table | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
This extension does not add any settings.