NetworkInspector.Exporters.DuckDb
0.6.0
dotnet add package NetworkInspector.Exporters.DuckDb --version 0.6.0
NuGet\Install-Package NetworkInspector.Exporters.DuckDb -Version 0.6.0
<PackageReference Include="NetworkInspector.Exporters.DuckDb" Version="0.6.0" />
<PackageVersion Include="NetworkInspector.Exporters.DuckDb" Version="0.6.0" />
<PackageReference Include="NetworkInspector.Exporters.DuckDb" />
paket add NetworkInspector.Exporters.DuckDb --version 0.6.0
#r "nuget: NetworkInspector.Exporters.DuckDb, 0.6.0"
#:package NetworkInspector.Exporters.DuckDb@0.6.0
#addin nuget:?package=NetworkInspector.Exporters.DuckDb&version=0.6.0
#tool nuget:?package=NetworkInspector.Exporters.DuckDb&version=0.6.0
NetworkInspector.Exporters.DuckDb
Columnar packet exporter that writes a single .duckdb database file for direct SQL analysis.
This package is separate from NetworkInspector.Exporters so DuckDB's native runtime is only
pulled in by consumers that actually export to DuckDB.
What This Is
The DuckDbExporter serializes parsed packets through IPacketListener into a DuckDB database,
built on the same ColumnarPacketBatch accumulator shared by the PBF columnar format and the
Parquet exporter in NetworkInspector.Exporters.
Overwrite semantics: exporting to an existing .duckdb path deletes the previous file (and
its .wal sidecar) before writing, so re-exports replace rather than append.
Install
dotnet add package NetworkInspector.Exporters.DuckDb
NetworkInspector.Exporters is a package dependency and does not need to be referenced separately.
Why Use It
- Query the export immediately with SQL — no separate load step.
- Bulk-loaded via
DuckDBAppender, never row-at-a-timeINSERT. FieldType.U64is stored as DuckDB's nativeUBIGINT.
Table Layout
| Table | Contents |
|---|---|
packets(packet_id INTEGER, timestamp_ns BIGINT [, info VARCHAR] [, frame_bytes BLOB]) |
One row per packet; packet_id matches Core PacketId (int) |
topology(packet_id INTEGER, node_id INTEGER, field_id INTEGER, parent_node_id INTEGER) |
One row per field-tree node |
catalog(field_id INTEGER, name VARCHAR, ui_name VARCHAR, field_type INTEGER, protocol_id INTEGER, table_name VARCHAR) |
One row per distinct field ID observed |
field_{id}(packet_id INTEGER, node_id INTEGER, value <type> [, custom_repr VARCHAR] [, custom_text VARCHAR]) |
One row per field occurrence; value is VARCHAR for FieldType.String |
Catalog is populated once in OnFinish(). Field data tables are created lazily.
Quick Start
using NetworkInspector.Exporters.DuckDb;
using DuckDbExporter exporter = DuckDbExporter.CreateBuilder()
.ToFile("packets.duckdb")
.Build();
foreach (Packet packet in packets)
{
if (!exporter.OnPacket(packet))
{
break;
}
}
exporter.OnFinish();
SELECT p.packet_id, p.timestamp_ns, f.value
FROM packets p
JOIN field_42 f USING (packet_id);
Builder Options
| Method | Purpose |
|---|---|
ToFile(path) |
Required. Output .duckdb file, created lazily on the first OnPacket() call |
WithUiName(name) / WithDescription(text) |
Set user-facing metadata |
WithCancellationToken(token) |
Enable cooperative cancellation |
WithTargetPacketCount(count) |
Stop after N packets (0 = unlimited) |
WithMaxPacketsPerBlock(count) |
Flush (and commit) the in-memory batch after N packets |
WithMaxBlockSize(bytes) |
Flush the in-memory batch by estimated size threshold |
WithDetailFlags(flags) |
Choose optional columns (info, frame bytes, custom representation/text, topology) |
WithTimestampSorted(sorted) |
Declares packets arrive in non-decreasing timestamp order |
Write Performance
- Every
WriteBatchcall wraps appends in a single explicitBEGIN/COMMITtransaction. - All data tables use
DuckDBAppender— never row-at-a-timeINSERT. CHECKPOINTruns exactly once at the end ofOnFinish().threadsandmemory_limitare set once per connection (Environment.ProcessorCount,4GB).
Limits And Thread-Safety Notes
- Not thread-safe; call
OnPacket()/OnFinish()sequentially. - If no packets are ever added, no database file is created.
- Call
OnFinish()(or dispose) to release the file handle.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- DuckDB.NET.Data.Full (>= 1.5.5)
- NetworkInspector.Exporters (>= 0.6.0)
- Parquet.Net (>= 6.1.0)
- ZeroAlloc (>= 0.5.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.6.0 | 46 | 8/21/2026 |