microsoft / Kusto-Query-Language

Kusto Query Language is a simple and productive language for querying Big Data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

False positives on KustoCode.ParseAndAnalyze (.alter table policy update with (AllowUnreferencedSourceTable=true))

jkindwall opened this issue · comments

Our team stores a fairly large library of .kql files in source control that are used to ensure the schema of our main database is properly in sync with the rest of our code. We frequently run into deployment failures due to errors in these kql files that were not caught during code review and we don't find out about them until we are attempting to deploy the changes to our database.

I would like to use this library and specifically the KustoCode.ParseAndAnalyze method in a validation step as part of our PR builds to try and catch these types of errors before they are merged into our main branch. However, I'm currently running into far too many false positives in kql code that actually executes without issue against the actual database.

I am using this library: https://github.com/mattwar/Kusto.Toolkit to automatically generate the GlobalState object based on the current state of our test environment database, then running each command through the ParseAndAnalyze() method to detect errors.

One such error pertains to a seemingly undocumented feature of the ".alter table policy update" command.

.alter table ["MyTable"] policy update with (AllowUnreferencedSourceTable=true)
@'['
'  {'
'    "IsEnabled": true,'
'    "IsTransactional": false,'
'    "PropagateIngestionProperties": false,'
'    "Query": "MyFunction",'
'    "Source": "MyOtherTable"'
'  }'
']'

KS006 - Missing string
It seems the analyzer if failing on this part: "with (AllowUnreferencedSourceTable=true)". This seems to be an undocumented feature of the .alter table policy update command, but the actual database supports it.

Thanks, I will look into this problem.

This should be fixed in the next version