Hi @Anonymous Greetings! Welcome to Microsoft Q&A forum. Thank you for posting the question here.
How to get all of them with single query?
This is interesting use case. The Digital Twin Query language has limitations which prevents usage of Subqueries. Also, with Select from Relationships
, you cannot use join
clause with it. With these limitations, I don't think it would be possible to form a single query to fetch the desired result. Please refer to the Limitations page of Digital Query for this information.
Perhaps you can try extracting$dtid
using the query SELECT $sourceId,$targetId FROM RELATIONSHIPS
and use SELECT * FROM DIGITALTWINS WHERE NOT ($dtId IN ['id1', 'id2'])
to get all the Digital Twins without a relationship. I haven't tested this completely and it might be complicated to get a list of distinct $dtId
from first query and pass it on as values to the NOT-IN
query. But, with this approach we perhaps can get a Pageable result.
You can provide product feedback using the following link and share the details to support complex querying using Azure Digital Twin Query language. Kindly share the feature link once you create so that other community members facing similar challenge can upvote the featrure request.
Hope this helps. Please let us know if you have any additional questions or need further assistance on this.
If the response helped, please do click Accept Answer and Yes Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.