Fields
Field markers are used inside Annotated[] to control how Python types map
to CQL column types, keys, and indexes.
- class coodie.fields.PrimaryKey(partition_key_index: int = 0)
Bases:
objectAnnotated marker: partition key column.
Use
partition_key_indexto define composite partition keys:product_id: Annotated[UUID, PrimaryKey(partition_key_index=0)] category: Annotated[str, PrimaryKey(partition_key_index=1)]
- partition_key_index: int = 0
- class coodie.fields.ClusteringKey(order: str = 'ASC', clustering_key_index: int = 0)
Bases:
objectAnnotated marker: clustering column.
- Parameters:
order –
"ASC"(default) or"DESC".clustering_key_index – Position within the clustering key (0-based).
- order: str = 'ASC'
- clustering_key_index: int = 0
- class coodie.fields.Indexed(index_name: str | None = None)
Bases:
objectAnnotated marker: create a secondary index on this column.
- index_name: str | None = None
- class coodie.fields.Counter
Bases:
objectAnnotated marker: counter column.
- class coodie.fields.BigInt
Bases:
objectAnnotated marker: maps
intto CQLbigint.
- class coodie.fields.SmallInt
Bases:
objectAnnotated marker: maps
intto CQLsmallint.
- class coodie.fields.TinyInt
Bases:
objectAnnotated marker: maps
intto CQLtinyint.
- class coodie.fields.VarInt
Bases:
objectAnnotated marker: maps
intto CQLvarint.
- class coodie.fields.Double
Bases:
objectAnnotated marker: maps
floatto CQLdouble.
- class coodie.fields.Ascii
Bases:
objectAnnotated marker: maps
strto CQLascii.
- class coodie.fields.TimeUUID
Bases:
objectAnnotated marker: maps
UUIDto CQLtimeuuid.
- class coodie.fields.Time
Bases:
objectAnnotated marker: maps to CQL
time.
- class coodie.fields.Static
Bases:
objectAnnotated marker: declares a column as
STATIC.Static columns are shared across all rows within a partition. They can only appear on tables that have at least one clustering column.
- class coodie.fields.Frozen
Bases:
objectAnnotated marker: wraps a collection or UDT type with
frozen<>.
- class coodie.fields.Duration
Bases:
objectAnnotated marker: maps a
CqlDurationfield to CQLduration.
- class coodie.fields.Discriminator
Bases:
objectAnnotated marker: discriminator column for polymorphic (single-table inheritance) models.
- class coodie.fields.Vector(dimensions: int)
Bases:
objectAnnotated marker: vector column for ANN similarity search.
Maps
list[float]to the CQLvector<float, N>type:embedding: Annotated[list[float], Vector(dimensions=384)]
- dimensions: int
- class coodie.fields.VectorIndex(similarity_function: str = 'COSINE')
Bases:
objectAnnotated marker: create a SAI vector index on this column.
Emits
CREATE CUSTOM INDEX … USING 'vector_index'with the chosen similarity function (COSINE,DOT_PRODUCT, orEUCLIDEAN):embedding: Annotated[list[float], Vector(dimensions=384), VectorIndex(similarity_function="COSINE")]
- similarity_function: str = 'COSINE'