Table of Contents

Class DuckDBConnectionStringBuilder

Namespace
DuckDB.NET.Data
Assembly
DuckDB.NET.Data.dll
public class DuckDBConnectionStringBuilder : DbConnectionStringBuilder, IDictionary, ICollection, IEnumerable, ICustomTypeDescriptor
Inheritance
DuckDBConnectionStringBuilder
Implements
Inherited Members

Fields

InMemoryConnectionString

public const string InMemoryConnectionString = "DataSource=:memory:"

Field Value

string

InMemoryDataSource

public const string InMemoryDataSource = ":memory:"

Field Value

string

InMemorySharedConnectionString

public const string InMemorySharedConnectionString = "DataSource=:memory:?cache=shared"

Field Value

string

InMemorySharedDataSource

public const string InMemorySharedDataSource = ":memory:?cache=shared"

Field Value

string

Properties

AccessMode

Access mode of the database. null leaves the option unset, so DuckDB's own default applies.

public DuckDBAccessMode? AccessMode { get; set; }

Property Value

DuckDBAccessMode?

AllowCommunityExtensions

Whether community-built extensions may be loaded.

public bool? AllowCommunityExtensions { get; set; }

Property Value

bool?

AllowPersistentSecrets

Whether persistent secrets, which are stored on disk and reloaded on restart, may be created.

public bool? AllowPersistentSecrets { get; set; }

Property Value

bool?

AllowUnsignedExtensions

Whether extensions with an invalid or missing signature may be loaded.

public bool? AllowUnsignedExtensions { get; set; }

Property Value

bool?

AutoinstallKnownExtensions

Whether known extensions may be installed automatically when a query depends on them.

public bool? AutoinstallKnownExtensions { get; set; }

Property Value

bool?

AutoloadKnownExtensions

Whether known extensions may be loaded automatically when a query depends on them.

public bool? AutoloadKnownExtensions { get; set; }

Property Value

bool?

CheckpointThreshold

The write-ahead log size threshold at which a checkpoint is triggered automatically, for example 1GB.

public string CheckpointThreshold { get; set; }

Property Value

string

CustomExtensionRepository

Overrides the endpoint used for remote extension installation.

public string CustomExtensionRepository { get; set; }

Property Value

string

CustomUserAgent

Metadata identifying the calling application, reported to DuckDB alongside the driver's own identifier.

public string CustomUserAgent { get; set; }

Property Value

string

DataSource

public string DataSource { get; set; }

Property Value

string

DefaultCollation

The collation used when none is specified.

public string DefaultCollation { get; set; }

Property Value

string

DefaultNullOrder

The NULL ordering used when an ORDER BY clause does not specify one.

public DuckDBNullOrder? DefaultNullOrder { get; set; }

Property Value

DuckDBNullOrder?

DefaultOrder

The sort order used when an ORDER BY clause does not specify one.

public DuckDBSortOrder? DefaultOrder { get; set; }

Property Value

DuckDBSortOrder?

EnableExternalAccess

Whether the database may access external state such as files, extensions and remote endpoints.

public bool? EnableExternalAccess { get; set; }

Property Value

bool?

ErrorsAsJson

Whether error messages are produced as structured JSON instead of a raw string.

public bool? ErrorsAsJson { get; set; }

Property Value

bool?

ExtensionDirectory

The directory in which extensions are stored.

public string ExtensionDirectory { get; set; }

Property Value

string

ExternalThreads

The number of external threads that work on DuckDB tasks.

public int? ExternalThreads { get; set; }

Property Value

int?

this[string]

Gets or sets the value associated with the specified key.

[AllowNull]
public override object this[string keyword] { get; set; }

Parameters

keyword string

The key of the item to get or set.

Property Value

object

The value associated with the specified key. If the specified key is not found, trying to get it returns a null reference (Nothing in Visual Basic), and trying to set it creates a new element using the specified key.

Passing a null (Nothing in Visual Basic) key throws an ArgumentNullException. Assigning a null value removes the key/value pair.

Exceptions

ArgumentNullException

keyword is a null reference (Nothing in Visual Basic).

NotSupportedException

The property is set, and the DbConnectionStringBuilder is read-only.

-or-

The property is set, keyword does not exist in the collection, and the DbConnectionStringBuilder has a fixed size.

LockConfiguration

Whether configuration options can still be altered after the database has been opened.

public bool? LockConfiguration { get; set; }

Property Value

bool?

MaxTempDirectorySize

The maximum amount of data stored inside TempDirectory, for example 1GB.

public string MaxTempDirectorySize { get; set; }

Property Value

string

MemoryLimit

The maximum memory the system may use, for example 1GB.

public string MemoryLimit { get; set; }

Property Value

string

PreserveInsertionOrder

Whether insertion order is preserved. Setting this to false lets DuckDB re-order results that have no ORDER BY clause, which can reduce memory usage.

public bool? PreserveInsertionOrder { get; set; }

Property Value

bool?

SecretDirectory

The directory to which persistent secrets are stored.

public string SecretDirectory { get; set; }

Property Value

string

StorageCompatibilityVersion

Serialize on checkpoint with storage compatibility for the given DuckDB version, for example v0.10.2.

public string StorageCompatibilityVersion { get; set; }

Property Value

string

TempDirectory

The directory to which temporary files are written when data does not fit in memory.

public string TempDirectory { get; set; }

Property Value

string

Threads

The total number of threads used by the system. DuckDB rejects zero and negative values.

public int? Threads { get; set; }

Property Value

int?

Methods

ContainsKey(string)

Determines whether the DbConnectionStringBuilder contains a specific key.

public override bool ContainsKey(string keyword)

Parameters

keyword string

The key to locate in the DbConnectionStringBuilder.

Returns

bool

true if the DbConnectionStringBuilder contains an entry with the specified key; otherwise false.

Exceptions

ArgumentNullException

keyword is a null reference (Nothing in Visual Basic).

GetProperties(Hashtable)

Adds a descriptor for every DuckDB configuration option that does not already have a typed property, so that property grids and other TypeDescriptor consumers can discover the full option set of the native library actually in use.

protected override void GetProperties(Hashtable propertyDescriptors)

Parameters

propertyDescriptors Hashtable

Remove(string)

Removes the entry with the specified key from the DbConnectionStringBuilder instance.

public override bool Remove(string keyword)

Parameters

keyword string

The key of the key/value pair to be removed from the connection string in this DbConnectionStringBuilder.

Returns

bool

true if the key existed within the connection string and was removed; false if the key did not exist.

Exceptions

ArgumentNullException

keyword is null (Nothing in Visual Basic)

NotSupportedException

The DbConnectionStringBuilder is read-only, or the DbConnectionStringBuilder has a fixed size.

ShouldSerialize(string)

Indicates whether the specified key exists in this DbConnectionStringBuilder instance.

public override bool ShouldSerialize(string keyword)

Parameters

keyword string

The key to locate in the DbConnectionStringBuilder.

Returns

bool

true if the DbConnectionStringBuilder contains an entry with the specified key; otherwise false.

TryGetValue(string, out object?)

Retrieves a value corresponding to the supplied key from this DbConnectionStringBuilder.

public override bool TryGetValue(string keyword, out object? value)

Parameters

keyword string

The key of the item to retrieve.

value object

The value corresponding to the keyword.

Returns

bool

true if keyword was found within the connection string, false otherwise.

Exceptions

ArgumentNullException

keyword contains a null value (Nothing in Visual Basic).