DuckDB.NET.Data 1.5.6

dotnet add package DuckDB.NET.Data --version 1.5.6
                    
NuGet\Install-Package DuckDB.NET.Data -Version 1.5.6
                    
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.

                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.

                    
Directory.Packages.props

                    
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 DuckDB.NET.Data --version 1.5.6
                    
#r "nuget: DuckDB.NET.Data, 1.5.6"
                    
#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 DuckDB.NET.Data@1.5.6
                    
#: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=DuckDB.NET.Data&version=1.5.6
                    
Install as a Cake Addin
#tool nuget:?package=DuckDB.NET.Data&version=1.5.6
                    
Install as a Cake Tool

DuckDB.NET

DuckDB bindings for C#

GitHub Workflow Status Coveralls License Ko-Fi Discord

NuGet DuckDB.NET.Data NuGet DuckDB.NET.Bindings

NuGet DuckDB.NET.Data.Full NuGet DuckDB.NET.Bindings.Full

Project Icon

Usage

dotnet add package DuckDB.NET.Data.Full
using (var duckDBConnection = new DuckDBConnection("Data Source=file.db"))
{
  duckDBConnection.Open();

  using var command = duckDBConnection.CreateCommand();

  command.CommandText = "CREATE TABLE integers(foo INTEGER, bar INTEGER);";
  var executeNonQuery = command.ExecuteNonQuery();

  command.CommandText = "INSERT INTO integers VALUES (3, 4), (5, 6), (7, 8);";
  executeNonQuery = command.ExecuteNonQuery();

  command.CommandText = "Select count(*) from integers";
  var executeScalar = command.ExecuteScalar();

  command.CommandText = "SELECT foo, bar FROM integers";
  var reader = command.ExecuteReader();

  PrintQueryResults(reader);
}

private static void PrintQueryResults(DbDataReader queryResult)
{
  for (var index = 0; index < queryResult.FieldCount; index++)
  {
    var column = queryResult.GetName(index);
    Console.Write($"{column} ");
  }

  Console.WriteLine();

  while (queryResult.Read())
  {
    for (int ordinal = 0; ordinal < queryResult.FieldCount; ordinal++)
    {
      var val = queryResult.GetInt32(ordinal);
      Console.Write(val);
      Console.Write(" ");
    }

    Console.WriteLine();
  }
}

MotherDuck

To connect to MotherDuck:

using var duckDBConnection = new DuckDBConnection("DataSource=md:{your_database}?motherduck_token=ey...");

DuckDB Extensions (C#)

If you want to build DuckDB extensions with C#, see Giorgi/DuckDB.ExtensionKit.

Known Issues

When debugging your project that uses DuckDB.NET library, you may get the following error: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. The error happens due to debugger interaction with the native memory. For a workaround check out Debugger Options mess up debugging session during Marshalling

Documentation

Documentation is available at https://duckdb.net

Support

If you encounter a bug with the library Create an Issue. Join the DuckDB dotnet channel for DuckDB.NET-related topics.

Contributors

Contributors

Sponsors

A big thanks to DuckLabs and AWS Open Source Software Fund for sponsoring the project!

DuckLabs

AWS

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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 (13)

Showing the top 5 NuGet packages that depend on DuckDB.NET.Data:

Package Downloads
DuckDB.InteractiveExtension

DuckDB support for Polyglot Notebooks

Microsoft.SemanticKernel.Connectors.DuckDB

DuckDB connector for Semantic Kernel plugins and semantic memory

EnergyExemplar.EntityFrameworkCore.DuckDb

Seamless integration between Entity Framework Core and DuckDB, providing significant performance improvements for analytical queries with a simple, developer-friendly API. Note: this package does not include the DuckDB or SQLite native libraries — you must add the appropriate DuckDB.NET or SQLite driver package separately.

NetEvolve.HealthChecks.DuckDB

Contains HealthChecks for DuckDB, based on the nuget package `DuckDB.NET.Data`.

Mostlylucid.LucidRAG.DataSummarizer

Core data file processing pipeline for CSV, JSON, Excel, Parquet, and SQLite database ingestion with relationship detection

GitHub repositories (5)

Showing the top 5 popular GitHub repositories that depend on DuckDB.NET.Data:

Repository Stars
dotnet/interactive
.NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.
erikdarlingdata/PerformanceMonitor
Free, open-source SQL Server and Postgres performance monitoring. Collectors, real-time alerts, graphical plan viewer, MCP server for AI analysis. Supports SQL 2016-2025, Azure SQL, AWS RDS, Postgres, Aurora Postgres.
Hitmasu/OpenCNPJ
API pública de busca e consulta de CNPJs do Brasil
buildersoftio/cortex
Cortex | Data Framework—a cutting-edge SDK that simplifies real-time data processing with intuitive operators, robust state management, and seamless telemetry for efficient, scalable pipelines.
jacking75/programming-books-with-ai
AI 와 같이 만든 프로그래밍 책들
Version Downloads Last Updated
1.5.6 1,869 9/28/2026
1.5.5 32,188 7/26/2026
1.5.3 23,685 5/24/2026
1.5.2 44,720 4/24/2026
1.5.0 25,781 3/10/2026
1.4.4 21,714 2/3/2026
1.4.4-alpha.2 521 12/19/2025
1.4.3 24,180 12/11/2025
1.4.1 39,572 10/13/2025
1.3.2 26,242 7/8/2025
1.3.0 31,517 6/3/2025
1.2.1 5,834 3/5/2025
1.2.1-alpha.8 202 2/19/2025
1.2.0 8,615 2/6/2025
1.1.3 91,849 11/7/2024
1.1.2.1 42,791 10/21/2024
1.1.2-alpha.5 193 10/10/2024
1.1.1 13,963 9/24/2024
1.1.0.1 5,558 9/9/2024
Loading failed

- Updated to DuckDB v1.5.6

New features:
- Typed properties for 24 DuckDB configuration options on DuckDBConnectionStringBuilder
- Read DECIMAL values that do not fit System.Decimal as BigInteger or DuckDBDecimal
- Bind BigInteger parameters wider than 128 bits to VARINT columns

Fixes:
- Fixed possible data loss on Linux and macOS when a reader opened with CommandBehavior.CloseConnection closed the last connection to a file database (#357)
- Errors in later chunks of a streaming result are now thrown instead of silently ending the result, in DuckDBDataReader and the Arrow stream (#356)
- Fixed a memory leak where results skipped with NextResult were never released
- Fixed incomplete appender rows being written with uninitialized values (#355)
- Fixed ARRAY values shifted by one row after a NULL array in the appender
- Fixed the appender writing to freed memory when a list of arrays grows
- Fixed table functions returning no rows after the first iteration of a recursive CTE (#348)

Behavior changes:
- GetFieldValue now returns the same value as GetValue
- Reading a LIST or MAP into an untyped target (object, ArrayList, List, or a Dictionary with object keys or values) throws InvalidCastException; use GetValue instead
- A failed ExecuteReader with CommandBehavior.CloseConnection now closes the connection, as in Npgsql
- Moving on from an incomplete appender row discards it and faults the appender: the next CreateRow or AppendRow throws, and rows completed before it are still written. Close, Dispose and Clear discard an incomplete row without an error
- A blob Stream from GetStream is valid only until the reader moves to the next result set