question

iibuan avatar image
2 Votes"
iibuan asked SatishBoddu-MSFT answered

$metadata.$model missing from query response

When I use this query to pull the twins of specific models, the return does not include the $metadata.$model property. This happened all of a sudden, the $model property used to be included on the result.

QUERY:

SELECT space FROM DIGITALTWINS space JOIN level RELATED space.isPartOf WHERE space.$metadata.$model IN [ {list of models here} ] AND level.$dtId = 'levelId'

SAMPLE SPACE OBJECT returned:

 {
     "space": {
         "$metadata": {
             "name": {
                 "lastUpdateTime": ""
             },
             "externalIds": {
                 "lastUpdateTime": ""
             }
         },
         "$dtId": "",
         "$etag": "",
         "name": "",
     }
 }


Also, I tried using simple queries like
SELECT * FROM DIGITALTWINS T WHERE T.$dtId = 'id'
and $metadata.$model property was there. It seems like the issue is happening only when using JOIN.

UPDATE:
I have a similar branch deployed on 2 different environments. The ADT on the environment deployed on West Europe has this issue, but the one on East US works just fine.


azure-digital-twins
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

iibuan avatar image
0 Votes"
iibuan answered

Updating the query to this worked.

 SELECT space FROM DIGITALTWINS space JOIN level RELATED space.isPartOf WHERE level.$dtId = 'levelId' AND ( IS_OF_MODEL(space, 'dtmi:example:space:room;1') OR IS_OF_MODEL(space, 'dtmi:example:space:room;2'))



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SatishBoddu-MSFT avatar image
0 Votes"
SatishBoddu-MSFT answered

Hello @iibuan Thanks for reaching out on this forum,

Have you seen any error messages in the output console window? I tried few queries in ADT-WestEurope and I can see the results, please let me know if you have tried the below queries?

 SELECT Floor, Room FROM DIGITALTWINS Floor JOIN Room RELATED Floor.contains WHERE Floor.$dtId = 'Floor1'
 SELECT Floor, Room FROM DIGITALTWINS Floor JOIN Room RELATED Floor.contains WHERE Floor.$metadata.$model ='dtmi:example:Floor;1' AND Floor.$dtId = 'Floor0'
 SELECT Floor, Room FROM DIGITALTWINS Floor JOIN Room RELATED Floor.contains WHERE Floor.$metadata.$model IN ['dtmi:example:Floor;1','dtmi:example:Floor;0'] AND Floor.$dtId = 'Floor0'

132447-image.png



image.png (250.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.