Search code examples
azure-data-explorerkql

KQL - is it possible to select the scope inside a request?


I specify cluster+database+table

cluster("my_company_kusto.westeurope").database("events").table("CourierEvents")
| where OrderId == "C61F4D3A8B93975111EC8A629DDBCF0E"

but I get an error Please select a database to execute queries. until I select a table in the left menu and the scope appears on the top.

Is it possible to select the scope inside a request without selecting it in a left menu?


Solution

  • I assume that you are using one of the tools (Kusto Explorer or the Kusto Web explorer), if so the answer is yes. See the connection panel topic in the Kusto Explorer docs, and here is the applicable example:

    #connect cluster('help').database('Samples')
    
    StormEvents | count
    

    Execute the first line, and it will set your context to the applicable cluster and database.