Provide a way to define a tuple of keys and reuse it in multiple places in a query
I find myself having a lot of queries with a pattern similar to the following:
table1 | summarize Sessions = dcount(Session_Id) by Column12, Column5, Column42
| join
(table2 | summarize ErrorSessions = dcount(Session_Id) by Column12, Column5, Column42)
on Column12, Column5, Column42
| sort by Column12, Column5, Column42
The worst part in repeating the keys again and again, besides readability, is that it makes it harder to maintain such queries, as any time I add or remove a key I have to update all of the locations to keep it consistent.
What I suggest is to have a way to define a tuple of keys, that can be reused in all of the contexts that keys are required (e.g. summarize by
, join by
and sort by
as in the example above).
It'd be nice if the tuple doesn't have to be the only argument, so it'd be possible to have one tuple shared between all subexpressions of the query but some of them may add more keys to the list (possibly using another tuple).
It'd be even better if such a tuple could be passed as argument to functions, as today we have a lot of functions that differ only in the keys they use for summarizing, instead of reusing the same basic function and just passing the keys as a parameter.
