Types
Low-level type mapping utilities that convert Python type annotations to CQL type strings.
- class coodie.types.CqlDuration(months: int = 0, days: int = 0, nanoseconds: int = 0)
Bases:
objectRepresents a CQL
durationvalue.CQL durations have three components that cannot be losslessly represented by
datetime.timedeltabecause months have variable length.- Parameters:
months – Number of months.
days – Number of days.
nanoseconds – Number of nanoseconds.
- months: int
- days: int
- nanoseconds: int
- coodie.types.python_type_to_cql_type_str(annotation: Any) str
Map a Python type annotation to its CQL type string.
- coodie.types.coerce_row_none_collections(doc_cls: type, row: dict[str, Any]) dict[str, Any]
Replace
Nonevalues for collection-typed fields with empty collections.Cassandra returns
Nonefor empty collections (list,set,map). Pydantic rejectsNonefor non-optional collection fields, so we coerce them to the appropriate empty container before constructing the model.