Create a sequence
- async AsyncCogniteClient.sequences.create(
- sequence: Sequence | SequenceWrite | Sequence[Sequence] | Sequence[SequenceWrite],
-
Deprecated since version 8.23.0: The Sequences API is deprecated and is scheduled for removal on 2027-12-31. Use files in data modeling (for whole-table downloads) or records (for row-level queries). See https://docs.cognite.com/cdf/deprecated for details and migration guidance.
- Parameters:
sequence (Sequence | SequenceWrite | Sequence[Sequence] | Sequence[SequenceWrite]) – Sequence or list of Sequence to create. The Sequence columns parameter is a list of objects with fields externalId (external id of the column, when omitted, they will be given ids of ‘column0, column1, …’), valueType (data type of the column, either STRING, LONG, or DOUBLE, with default DOUBLE), name, description, metadata (optional fields to describe and store information about the data in the column). Other fields will be removed automatically, so a columns definition from a different sequence object can be passed here.
- Returns:
The created sequence(s).
- Return type:
Sequence | SequenceList
Examples
Create a new sequence:
>>> from cognite.client import CogniteClient >>> from cognite.client.data_classes import SequenceWrite, SequenceColumnWrite >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> column_def = [ ... SequenceColumnWrite( ... value_type="STRING", external_id="user", description="some description" ... ), ... SequenceColumnWrite(value_type="DOUBLE", external_id="amount"), ... ] >>> seq = client.sequences.create( ... SequenceWrite(external_id="my_sequence", columns=column_def) ... )
Create a new sequence with the same column specifications as an existing sequence:
>>> seq2 = client.sequences.create( ... SequenceWrite(external_id="my_copied_sequence", columns=column_def) ... )