def _lookupAttribtue(self, index):
if isinstance(index, dict):
if "object_id" in index:
index["attributes"] = {}
for row in self._connection.execute(md.InventoryObjectAttributes.select().where(and_(md.InventoryObjectAttributes.c.object_id == index["object_id"]))):
index["attributes"][row["attr_key"]] = row["attr_value"]
return index
else:
d = {}
for row in self._connection.execute(md.InventoryObjectAttributes.select().where(and_(md.InventoryObjectAttributes.c.object_id == index))):
d[row["attr_key"]] = row["attr_value"]
return d
评论列表
文章目录