Skip to main content
Question

match entities with python sdk course, DataSet.__init__() missing details

  • March 6, 2026
  • 1 reply
  • 10 views

Hi,

In the course “match entities with python sdk ” https://learn.cognite.com/match-entities-with-python-sdk, when running the notebook, I can modify it to connect to Cognite using the same credentials as in the “Learn to Use the Cognite Python SDK” course.

 

When I get to cell 5, I get this error:

“””
TypeError: DataSet.__init__() missing 5 required positional arguments: 'id', 'created_time', 'last_updated_time', 'description', and 'metadata'
“””

This is what is in cell 5:

# Create datasets
try:
bra_dataset = client.data_sets.create(DataSet(external_id="BRA_TestData", name='TestDataset', write_protected=True))
except CogniteDuplicatedError as e:
print("BRA_TestData already exists, you can continue")
bra_dataset = client.data_sets.retrieve(external_id="BRA_TestData")
try:
nor_dataset = client.data_sets.create(DataSet(external_id="NOR_TestData", name='TestDataset', write_protected=True))
except CogniteDuplicatedError as e:
print("NOR_TestData already exists, you can continue")
nor_dataset = client.data_sets.retrieve(external_id="NOR_TestData")
assert isinstance(nor_dataset, DataSet )
assert isinstance(bra_dataset, DataSet )

It seems to be having the issue becasue “DataSet” in line 3 is for reading, not writing.

 

To get it to work, I needed to:
1. Add this to the cell:

from cognite.client.data_classes import DataSet, DataSetWrite
from cognite.client.exceptions import CogniteDuplicatedError
  1. Change both instances of: “.create(DataSet(external_id="BRA_TestData"” to “.create(DataSetWrite(external_id="BRA_TestData"”

1 reply

Akshay Chougule
Practitioner
Forum|alt.badge.img+1

Hi ​@jb2026 Thanks for reaching out, Cognite Academy! As you pointed out to the issue you are facing with the course “match entities with python sdk ” https://learn.cognite.com/match-entities-with-python-sdk. As mentioned in the “How to succeed with this course”(Screenshot attached), this course is built for demonstration only, and no hands-on environment is provided for this project. If you need to try it hands-on, you must set up the right environment.