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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NetworkInspector.Exporters.DuckDb" Version="0.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NetworkInspector.Exporters.DuckDb" Version="0.6.0" />
                    
Directory.Packages.props
<PackageReference Include="NetworkInspector.Exporters.DuckDb" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NetworkInspector.Exporters.DuckDb --version 0.6.0
                    
#r "nuget: NetworkInspector.Exporters.DuckDb, 0.6.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NetworkInspector.Exporters.DuckDb@0.6.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NetworkInspector.Exporters.DuckDb&version=0.6.0
                    
Install as a Cake Addin
#tool nuget:?package=NetworkInspector.Exporters.DuckDb&version=0.6.0
                    
Install as a Cake Tool

NetworkInspector.Exporters.DuckDb

NuGet

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-time INSERT.
  • FieldType.U64 is stored as DuckDB's native UBIGINT.

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 WriteBatch call wraps appends in a single explicit BEGIN/COMMIT transaction.
  • All data tables use DuckDBAppender — never row-at-a-time INSERT.
  • CHECKPOINT runs exactly once at the end of OnFinish().
  • threads and memory_limit are 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

MIT License

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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