Search code examples
azureazure-data-explorerkqlkusto-explorer

Referring Kusto Materialized views while it is being created


I am running a microservice that triggers the async creation of Materialized views to the Kusto engine, and in the same process, it creates some User Defined Functions which refer to the above-created materialized views. But the Kusto engine is failing the function creation queries with 400. I don't see any other issue causing bad query errors, so I want to confirm if we can refer to materialized views while they are being created.


Solution

  • If you want to create a function that references an entity that doesn't exist yet (e.g. a materialized view that is still in the process of creation), you can use the skipvalidation flag when creating the function.

    Note: if there are other issues with the logic in your function, they will not be validated either.

    An alternative way would be for your process to periodically poll for the materialized view creation operation's status, using .show operations, wait for it to complete successfully, and only then create the function referencing it (without having to use the aforementioned flag)