How to get DTDL of complete Digital Twin setup?

Domagoj Bazina 221 Reputation points

Greetings everyone,
I'm wondering, is there any way to get DTDL of the complete Digital Twin setup, the one that includes Digital Twin instances and relationships?
I know there is a python SDK library to manage Digital Twin resource, but I can't find a single command/method to fetch complete DT setup.

There is an example ( where you can get all digital twin instances by using query commands, or to get relationships based on Digital Twin instances. In order to get a complete setup, I would have to make several requests and combine them together.

Thanks in advance

Azure Digital Twins
Azure Digital Twins
An Azure platform that is used to create digital representations of real-world things, places, business processes, and people.
217 questions
0 comments No comments
{count} votes

Accepted answer
  1. Matthijs van der Veer 4,371 Reputation points MVP

    There is no single command that will get the complete content of the Digital Twin graph. However, you can do it by making multiple calls through the SDK. The approach is as follows:

    Query all the twins

    query_expression = 'SELECT * FROM digitaltwins'  
    query_result = service_client.query_twins(query_expression)  

    Loop through the results and get the Incoming or Outgoing relationships for each twin.


    You can also get all the models through the SDK

    listed_models = service_client.list_models()  

    There's documentation for the Python SDK

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful