Changes are grouped as follows:
Dependency
for new hard requirements that you must make sure work with your project before upgradingDeprecated
for methods/features that are still available, but will be removed in a future releaseRemoved
for methods/features that have been removed (and what to do now!)Function Signature
for methods/functions with a change to its function signature, e.g. change in default valuesFunctionality
for changes that are not backwards compatibleChanged
for changes that do not fall into any other categoryOptional
for new, optional methods/features that you should be aware of - and could take advantage of
CogniteResource.to_pandas
andCogniteResourceList.to_pandas
now converts known timestamps todatetime
by default. Can be turned off with the new parameterconvert_timestamps
. Note: To comply with older pandas v1, the dtype will always bedatetime64[ns]
, although in v2 this could have beendatetime64[ms]
.- Read operations, like
retrieve_multiple
will now fast-fail. Previously, all requests would be executed before the error was raised, potentially fetching thousands of unneccesary resources.
- The Templates API is deprecated, and will be removed in a future version. Please migrate to Data Modeling. Read more at: https://docs.cognite.com/cdf/data_modeling/
- The
client.assets.aggregate
useclient.assets.aggregate_count
instead. - The
client.events.aggregate
useclient.events.aggregate_count
instead. - The
client.sequence.aggregate
useclient.sequence.aggregate_count
instead. - The
client.time_series.aggregate
useclient.time_series.aggregate_count
instead.
- Deprecated method
aggregate_metadata_keys
on AssetsAPI. Update your query fromaggregate_metadata_keys(filter=my_filter)
toaggregate_unique_properties("metadata", filter=my_filter)
. - Deprecated method
aggregate_metadata_values
on AssetsAPI. Update your query fromaggregate_metadata_values(keys=["country"], filter=my_filter)
toaggregate_unique_values(["metadata", "country"], filter=my_filter)
. - Deprecated method
update_feature_types
on GeospatialAPI, usepatch_feature_types
instead. - The
SequenceColumns
no longer set theexternal_id
tocolumn{no}
if it is missing. It now must be set explicitly by the user. - Dataclasses
ViewDirectRelation
andContainerDirectRelation
are replaced byDirectRelation
. - Dataclasses
MappedPropertyDefinition
andMappedApplyPropertyDefinition
are replaced byMappedProperty
andMappedPropertyApply
. - Dataclasses
RequiresConstraintDefinition
andUniquenessConstraintDefinition
are replaced byRequiresConstraint
andUniquenessConstraint
. - In data class
Transformation
attributeshas_source_oidc_credentials
andhas_destination_oidc_credentials
are replaced by properties.
- All
.dump
methods for CogniteResource classes likeAsset
orEvent
now usescamel_case=True
by default. This is to match the intended use case, preparing the object to be sent in an API request. CogniteResource.to_pandas
now more closely resemblesCogniteResourceList.to_pandas
with parametersexpand_metadata
andmetadata_prefix
, instead of accepting a sequence of column names (expand
) to expand, with no easy way to add a prefix. Also, it no longer expands metadata by default.- Additionally,
Asset.to_pandas
, haveexpand_aggregates
andaggregates_prefix
. Since the possibleaggregates
keys are known,camel_case
will also apply to these if expanded as opposed to metadata keys. - Removed parameters
property
andaggregates
for methodaggregate_unique_values
on GeospatialAPI, use theoutput
parameter instead. - Removed parameter
fields
for methodaggregate_unique_values
on EventsAPI, use the other aggregate-prefixed methods instead. - Removed parameter
function_external_id
for methodcreate
on FunctionSchedulesAPI (function_id has been required since the deprecation of API keys). client.data_modeling.instances.aggregate
the parametersinstance_type
andgroup_by
has swapped order.- The return type of
client.data_modeling.instances.aggregate
has changed fromInstanceAggregationResultList
to a more specific valueAggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList
depending on theaggregates
andgroup_by
parameters. - The
client.sequences.data
methods.retrieve
and.insert
method has changed signature: The parametercolumn_external_ids
is renamedcolumns
. The old parametercolumn_external_ids
is still there, but is deprecated. In addition, int the.retrieve
method, the parametersid
andexternal_id
have been moved to the beginning of the signature. This is to better match the API and have a consistent overload implementation. - The
client.sequences.data.retrieve_latest
is renamedclient.sequences.data.retrieve_last_row
.
- All
assert
s meant for the SDK user, now raise appropriate errors instead (ValueError
,RuntimeError
...). CogniteAssetHierarchyError
is no longer possible to catch as anAssertionError
.- More narrow exception types like
CogniteNotFoundError
andCogniteDuplicatedError
are now raised instead ofCogniteAPIError
for the following methods:DatapointsAPI.retrieve_latest
,RawRowsAPI.list
,RelationshipsAPI.list
,SequencesDataAPI.retrieve
,SyntheticDatapointsAPI.query
. Additionally, all calls usingpartitions
to API methods likelist
(or the generator version) now do the same. - Several methods in the data modelling APIs have had parameter names now correctly reflect whether they accept a single or multiple items (i.e. id -> ids).
- Passing
limit=0
no longer returnsDEFAULT_LIMIT_READ
(25) resources, but raises aValueError
. - Loading
ObjectDetection
attributes.attributes
,.bounding_box
,.polygon
and.polyline
now returns typesdict[str, Attribute]
,BoundingBox
,Polygon
andPolyline
instead ofdicts
. - Loading
TextRegion
attribute.text_region
now returnBoundingBox
instead ofdict
. - Loading
AssetLink
attribute.text_region
and.asset_ref
returnsBoundingBox
andCdfResourceRef
instead ofdict
. - Loading
KeypointCollection
attributes.keypoints
and.attributes
returndict[str, Keypoint]
anddict[str, Attribute]
instead ofdict
. - Loading
VisionExtractPredictions
the attributestext_predictions
,asset_tag_prediction
,industrial_object_prediction
,people_predictions
,personal_protective_equipment_predictions
,digital_gauge_predictions
,dial_gauge_predictions
,level_gauge_predictions
,valve_predictions
now returnsdict[str, TextRegion]
,list[AssetLink]
,list[ObjectDetection]
,list[KeypointCollectionWithObjectDetection]
instead ofdict
. - Loading
FeatureParameters
the attributestext_detection_parameters
,asset_tag_detection_parameters
,industrial_object_prediction_parameters
,personal_protective_equipment_parameters
,digital_gauge_parameters
,dial_gauge_detection_parameters
,level_gauge_parameters
,valve_detection_parameters
now returnsTextDetectionParameter
,AssetTagDetectionParameters
,PeopleDetectionParameters
,IndustrialObjectDetectionParameters
,PersonalProtectiveEquimentDetectionParameters
,DigitalGaugeDetection
,ValveDetection
instead ofdict
. - Loading
ExtractionPipeline
the attribute.contacts
now returnslist[ExtractionPipelineContact]
instead ofdict
. - Loading
GeospatialComputedResponse
the attribute.items
now returnsGeospatialComputedItemList
instead oflist[dict]
. - Loading
Transformation
the attributes.running_job
,.last_finished_job
,.blocked
,.schedule
.source_session
,.destination_session
,.source_nonce
,destination_nonce
,.source_oidc_credentials
,.destination_oidc_credentials
now returnsTransformationJob
,TransformationBlockedInfo
,TransformationSchedule
,SessionDetails
,NonceCredentials
OidcCredentials
, instead ofdict
s. - Loading
TransformationPreviewResult
the attribute.schema
now returnsTransformationSchemaColumnList
instead oflist[dict]
. - Loading
TransformationJob
the attribute.destination
and.status
now returnTransformationDestination
andTransformationJobStatus
instead ofdict
. - The
Group
attributecapabilities
is now aCapabilities
object, instead of adict
. - The class
SequenceData
has been replaced bySequenceRows
. The oldSequenceData
class is still available for backwards compatibility, but will be removed in the next major version. However, all API methods now returnSequenceRows
instead ofSequenceData
. - The attribute
columns
inSequence
has been changed fromSequenceType[dict]
toSequnceColumnList
. - The class
SequenceRows
inclient.data_classes.transformations.common
has been renamed toSequenceRowsDestination
. - Classes
Geometry
,AssetAggregate
,AggregateResultItem
,EndTimeFilter
,Label
,LabelFilter
,ExtractionPipelineContact
,TimestampRange
,AggregateResult
,GeometryFilter
,GeoLocation
,RevisionCameraProperties
,BoundingBox3D
are no longerdict
but classes with attributes matchhng the API. - Calling
client.iam.token.inspect()
now gives an objectTokenInspection
with attributecababilities
of typeProjectCapabilityList
instead oflist[dict]
- In data class
Transformation
the attributeschedule
,running_job
, andlast_running_job
,external_id
andid
are set to theTransformation
id
andexternal_id
if not set. If they are set to a different value, aValueError
is raised
CogniteImportError
can now be caught asImportError
.
- Removed support for legacy auth (API keys, service accounts, client.login.status()). Use OIDC to authenticate instead and use
client.iam.token.inspect()
instead oflogin.status()
. - Removed the deprecated
extractionPipeline
argument toclient.extraction_pipelines.create
. Onlyextraction_pipeline
is accepted now. - Removed the deprecated
client.datapoints
accessor attribute. The datapoints API can only be accessed throughclient.time_series.data
now. - Removed the deprecated
client.extraction_pipeline_runs
accessor attribute. The extraction pipeline run API can only be accessed throughclient.extraction_pipelines.runs
now. - Removed the deprecated
external_id
attribute onExtractionPipelineRun
. This has been replaced withextpipe_external_id
.
- Required dependency,
protobuf
. - Optional dependency,
numpy
(performance benefits, but requires refactoring).
- Consider changing
client.datapoints
(deprecated) toclient.time_series.data
.
DatapointsAPI.query
: All three retrieve-endpoints now support arbitrarily complex queries. See docstring ofDatapointsAPI.retrieve
for example usage.DatapointsAPI.retrieve_dataframe_dict
: Not needed as the combination of.get
and e.g..average
covers the same use case - with simpler syntax.- Exception
CogniteDuplicateColumnsError
: Duplicated identifiers in datapoint queries are now allowed. - All convenience methods related to plotting and the use of
matplotlib
(go ask your FNDS <3 (Friendly Neighborhood Data Scientist).
- All parameters to all retrieve methods are now keyword-only (meaning no positional arguments are supported).
- All Cognite resource types (data classes) have a
to_pandas
(orto_geopandas
) method. Previously, these had various defaults for thecamel_case
parameter, but they have all been changed toFalse
. DatapointsAPI.insert_dataframe
has new default values for:dropna
: Changed fromFalse
toTrue
(functionality unchanged, applies per-column)external_id_headers
: Changed fromFalse
toTrue
to disincentivize the use of internal IDs.
DatapointsAPI.retrieve_dataframe
no longer has a mix ofid
s andexternal_id
s in the columns when given identifiers for both arguments. Instead, the user might select either by passing the new parametercolumn_names
.DatapointsAPI.retrieve_dataframe
no longer supports thecomplete
parameter.DatapointsAPI.retrieve_dataframe
now accepts the parameteruniform_index (bool)
. See function docstring for explanation and usage examples.
- Fetching datapoints with
limit=0
no longer returns default number of datapoints, but 0. - Fetching raw datapoints with a finite
limit
andinclude_outside_points=True
now returns both outside points (if they exist) regardless of the givenlimit
, meaning the returned datapoints count is up tolimit+2
. - Fetching aggregate datapoints now includes the time period(s) (given by the
granularity
unit) thatstart
andend
are part of (used to be only the "fully in-between" points). - The
get
method ofDatapointsList
andDatapointsArrayList
now returns a list ofDatapoints
(or list ofDatapointsArray
) for all identifiers that were duplicated in the user's query. Previously duplicated identifiers would raise prior to fetching data with one exception: (weird edge case) when passing theid
andexternal_id
for the same time series. - The ordering of columns with aggregates in
pandas.DataFrame
s as returned byDatapointsAPI.retrieve_dataframe
,Datapoints.to_pandas
andDatapointsList.to_pandas
is now chronological, i.e.average
beforediscrete_variance
which in turn comes beforesum
. - The utility function
datetime_to_ms
no longer issues aFutureWarning
on missing timezone information. It will interpret naivedatetime
s as local time as is Python's default interpretation. - The utility function
ms_to_datetime
no longer issues aFutureWarning
on returning a naivedatetime
in UTC. It will now return an awaredatetime
object in UTC. - The utility function
ms_to_datetime
no longer raisesValueError
for inputs from before 1970, but will raise for input outside the allowed minimum- and maximum supported timestamps in the API.
- Resource types
DatapointsArray
andDatapointsArrayList
which offer way more efficient memory storage for datapoints (usesnumpy.ndarrays
) - New datapoints fetching method,
DatapointsAPI.retrieve_arrays
, returningDatapointsArray
andDatapointsArrayList
. - A single aggregate, e.g.
average
, can be specified by a string directly,aggregates="average"
(as opposed to packing it inside a list,aggregates=["average"]
)
...
...
...