irom
irom

Reputation: 3596

Get Azure Log Analytics QueryResults in Python

I am getting a query response from Azure Log Analytics

result = log_client.query(myWorkSpaceId, QueryBody(**{'query': 'Heartbeat| limit 50'}))
print (result)
'additional_properties': {}, 'tables': [<azure.loganalytics.models.table_py3.Table object at 0x11011b090>]}

This object contains the tables, columns & rows resulting from a query. But how I can get these tables, how do I find names ?

Upvotes: 0

Views: 505

Answers (1)

Joy Wang
Joy Wang

Reputation: 42043

You could refer to the samples below.

1.Print the tables.

print(result.tables)

enter image description here

2.Print the first table.

print(result.tables[0])

enter image description here

3.Print the name of the first table.

print(result.tables[0].name)

enter image description here

4.Print the first column of the first table.

print(result.tables[0].columns[0])

enter image description here

5.Print the first row of the first table.

print(result.tables[0].rows[0])

enter image description here

Upvotes: 1

Related Questions