Method BuildCreateSql
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
namestringThe table name.
dimsintThe vector column's dimensionality (1 to 8192).
metricVecMetric?The distance metric, or null for a Bit column, which rejects one.
elementTypeVecElementTypeThe vector column's element type.
auxIEnumerable<VecAuxColumn>Auxiliary columns, selectable but never filterable in a KNN
WHEREclause.metadataIEnumerable<VecMetadataColumn>Metadata columns, filterable with comparison operators.
partitionsIEnumerable<VecPartitionKey>Partition keys, pre-filtered with
=constraints.chunkSizeint?The
chunk_sizeoption; must be a positive multiple of 8 up to 4096, or null to leave it unset.vectorColumnstringThe vector column's name.
Returns
- string
The complete
CREATE VIRTUAL TABLEstatement.
Exceptions
- ArgumentException
nameorvectorColumnis null, empty, or whitespace; ormetricis set on a Bit column.- ArgumentOutOfRangeException
dims,chunkSize, or the size ofaux,metadataorpartitionsis out of range.