DuckDB.NET.Data.Full 1.5.6

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

No packages depend on DuckDB.NET.Data.Full.

- 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<object> now returns the same value as GetValue - Reading a LIST or MAP into an untyped target (object, ArrayList, List<object>, 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

.NET 10.0

.NET 8.0

Version Downloads Last updated
1.5.6.1 0 10/15/2026
1.5.6 2 09/29/2026
1.5.5 4 08/09/2026
1.5.3 3 08/12/2026
1.5.2 3 08/12/2026
1.5.0 3 08/12/2026
1.4.4 3 08/12/2026
1.4.4-alpha.2 3 08/12/2026
1.4.3 3 08/12/2026
1.4.1 3 08/12/2026
1.3.2 3 08/12/2026
1.3.0 3 08/12/2026
1.2.1 3 08/12/2026
1.2.1-alpha.8 3 08/12/2026
1.2.0 3 08/12/2026
1.1.3 3 08/12/2026
1.1.2.1 3 08/12/2026
1.1.2-alpha.5 3 08/12/2026
1.1.1 3 08/12/2026
1.1.0.1 3 08/12/2026
1.0.2 3 08/12/2026
1.0.1 3 08/12/2026
1.0.0 3 08/12/2026
0.10.3 3 08/12/2026
0.10.2 3 08/12/2026
0.10.1.2 3 08/12/2026
0.10.1 3 08/12/2026
0.9.2 3 08/12/2026
0.9.1 3 08/12/2026
0.9.0.3 3 08/12/2026
0.9.0 3 08/12/2026
0.8.1 3 08/12/2026
0.8.0 3 08/12/2026
0.7.1 3 08/12/2026
0.6.1 2 08/12/2026