Table of Contents

Method BuildCreateSql

Namespace
Qavren.Edge.Sqlite.Vec
Assembly
Qavren.Edge.Sqlite.dll

BuildCreateSql(string, int, VecMetric?, VecElementType, IEnumerable<VecAuxColumn>?, IEnumerable<VecMetadataColumn>?, IEnumerable<VecPartitionKey>?, int?, string)

Builds the CREATE VIRTUAL TABLE ... USING vec0(...) statement for the given shape, enforcing sqlite-vec's own caps up front.

public static string BuildCreateSql(string name, int dims, VecMetric? metric = VecMetric.Cosine, VecElementType elementType = VecElementType.Float32, IEnumerable<VecAuxColumn>? aux = null, IEnumerable<VecMetadataColumn>? metadata = null, IEnumerable<VecPartitionKey>? partitions = null, int? chunkSize = null, string vectorColumn = "embedding")

Parameters

name string

The table name.

dims int

The vector column's dimensionality (1 to 8192).

metric VecMetric?

The distance metric, or null for a Bit column, which rejects one.

elementType VecElementType

The vector column's element type.

aux IEnumerable<VecAuxColumn>

Auxiliary columns, selectable but never filterable in a KNN WHERE clause.

metadata IEnumerable<VecMetadataColumn>

Metadata columns, filterable with comparison operators.

partitions IEnumerable<VecPartitionKey>

Partition keys, pre-filtered with = constraints.

chunkSize int?

The chunk_size option; must be a positive multiple of 8 up to 4096, or null to leave it unset.

vectorColumn string

The vector column's name.

Returns

string

The complete CREATE VIRTUAL TABLE statement.

Exceptions

ArgumentException

name or vectorColumn is null, empty, or whitespace; or metric is set on a Bit column.

ArgumentOutOfRangeException

dims, chunkSize, or the size of aux, metadata or partitions is out of range.