Search code examples
azure-application-insightskql

Setting table name for AppInsights REST API


I'm trying to use the AppInsights REST API (api.applicationinsights.io). Let's imagine a query like this:

{
    "query": "customEvents | take 10; customEvents | take 10"
}

In the result output, I receive this:

{
    "tables": [
        {
            "name": "PrimaryResult",
            "columns": [...],
            "rows": [...]
        },
        {
            "name": "PrimaryResult",
            "columns": [...],
            "rows": [...]
        }
    ]
}

My question is: how can I set the "name" property to something telling? If nothing else, it's confusing to have them all be named PrimaryResult. Can I assume that the order of appearance is the same as in the query itself?


Solution

  • you could try using the as operator.

    for example:

    customEvents | take 10 | as first_table;
    customEvents | take 10 | as second_table;