python - Azure 数字孪生 Python API - 创建了模型孪生,但无法检索它

标签 python azure azure-digital-twins

我使用 azure.digitaltwins.core.DigitalTwinsClientupsert_digital_twin() 方法成功创建了一个模型的孪生模型,该方法返回如下所示的对象(打印为字典) ):

{
    $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'}
}

但是,当我尝试使用 get_digital_twin() 方法获取此模型时,出现以下错误:

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.

发生了什么事?我怎样才能找回我创建的双胞胎?

最佳答案

提出支持请求后,我被要求运行查询

SELECT * FROM digitaltwins T where T.$dtId = <model_identifier>

这有效并且专门针对节点。随后运行

SELECT * FROM digitaltwins

显示所有创建的节点。

我的猜测是 ADT 浏览器没有将注意力集中在正确的节点上,这就是我看不到它的原因。

关于python - Azure 数字孪生 Python API - 创建了模型孪生,但无法检索它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70382564/

相关文章:

python - TensorFlow 估计器 DNNClassifier 无法进行 2 次线性分离

python - 如何对seaborn relplot的轴使用对数刻度?

用于限制数据库扩展的 Azure 策略

azure - 将 Azure 数字孪生与现有云环境连接

javascript - 如何将变量发送到JavaScript?

python - 使用 numpy 和 scipy 填充图像上的空白

azure - 与 DevOps Server 实例共享 Visual Studio Marketplace Extension

azure - 在ADF中,使用摄取功能提取数据效果很好,但无法使用数据流提取数据。有什么建议么?

Azure Digital Twin 查询中的禁用词

azure - 如何将数据从 UDF 发送到 Azure Digital Twin 中的 Cosmos DB?