Reputation: 408
I have succesfully created a twin of a model using the azure.digitaltwins.core.DigitalTwinsClient
with the upsert_digital_twin()
method returning an object like below (printed as dictionary):
{
$dtId twin-spc4-4b670a8e-86ec-41b0-84a2-ce092578a0f6
$etag W/"8c491e49-f81f-4c30-b189-1bd45f122d7c"
area {'$metadata': {}}
capacity {'$metadata': {}}
occupancy {'$metadata': {}}
temperature {'$metadata': {}}
humidity {'$metadata': {}}
CO2 {'$metadata': {}}
$metadata {'$model': 'dtmi:digitaltwins:rec_3_3:core:Level;1'}
}
However when I try and get this model using the get_digital_twin()
method I get the following error:
azure.core.exceptions.ResourceNotFoundError: (DigitalTwinNotFound) There is no digital twin instance that exists with the ID {'$dtId': 'twin-spc4-4b670a8e-86ec-41b0-84a2-ce092578a0f6', '$etag': 'W%2F"8c491e49-f81f-4c30-b189-1bd45f122d7c"', 'area': {'$metadata': {}}, 'capacity': {'$metadata': {}}, 'occupancy': {'$metadata': {}}, 'temperature': {'$metadata': {}}, 'humidity': {'$metadata': {}}, 'CO2': {'$metadata': {}}, '$metadata': {'$model': 'dtmi:digitaltwins:rec_3_3:core:Level;1'}}. Please verify that the twin id is valid and ensure that the twin is not deleted. See section on querying the twins https://aka.ms/adtv2query.
Code: DigitalTwinNotFound
Message: There is no digital twin instance that exists with the ID {'$dtId': 'twin-spc4-4b670a8e-86ec-41b0-84a2-ce092578a0f6', '$etag': 'W%2F"8c491e49-f81f-4c30-b189-1bd45f122d7c"', 'area': {'$metadata': {}}, 'capacity': {'$metadata': {}}, 'occupancy': {'$metadata': {}}, 'temperature': {'$metadata': {}}, 'humidity': {'$metadata': {}}, 'CO2': {'$metadata': {}}, '$metadata': {'$model': 'dtmi:digitaltwins:rec_3_3:core:Level;1'}}. Please verify that the twin id is valid and ensure that the twin is not deleted. See section on querying the twins https://aka.ms/adtv2query.
What is happening? How can I retrieve the twin I created?
Upvotes: 1
Views: 323
Reputation: 408
after raising a support ticket, I was asked to run the query
SELECT * FROM digitaltwins T where T.$dtId = <model_identifier>
This worked and focused specifically on the node. Subsequently running
SELECT * FROM digitaltwins
showed all the nodes created.
My guess is the ADT explorer hadn't focused itself on the right node and that's why I couldn't see it.
Upvotes: 1