microsoft / delta-kusto

Engine able to compute delta between ADX clusters (and/or Kusto scripts) and generate update scripts
MIT License
47 stars 19 forks source link

Deployment fails on function including `with (view = true)` #143

Closed doweaver-msft closed 1 year ago

doweaver-msft commented 1 year ago

Succeeds:

.create-or-alter function
MyViewExample()
{
    datatable(x:int) [42]
}

Fails:

.create-or-alter function
with (view = true)
MyViewExample()
{
    datatable(x:int) [42]
}

Error message:

Error:  Issue in running job 'deploy-to-personal-db'
  Error:  Issue parsing script
  Error:  .create-or-alter function
with (view = true)
MyViewExample()
{
datatable(x:int) [42]
}
    Error:  There should be one-and-only-one Property name but there are 0
    Error:  .create-or-alter function
with (view = true)
MyViewExample()
{
datatable(x:int) [42]
}
    Exception encountered:  DeltaKustoLib.DeltaException ; There should be one-and-only-one Property name but there are 0
    Stack trace:     at DeltaKustoLib.CommandModel.CodeHelper.GetUniqueDescendant[TElement](SyntaxElement parent, String descendantNameForExceptionMessage, Func`2 predicate)
   at DeltaKustoLib.CommandModel.CreateFunctionCommand.<>c.<GetProperties>b__23_1(SeparatedElement p)
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at DeltaKustoLib.CommandModel.CreateFunctionCommand.GetProperties(FunctionDeclaration functionDeclaration, QuotedText& folder, QuotedText& docString)
   at DeltaKustoLib.CommandModel.CreateFunctionCommand.FromCode(SyntaxElement rootElement)
   at DeltaKustoLib.CommandModel.CommandBase.CreateCommand(String script, KustoCode code, Boolean ignoreUnknownCommands)
   at DeltaKustoLib.CommandModel.CommandBase.ParseAndCreateCommand(String script, Boolean ignoreUnknownCommands)
  Exception encountered:  DeltaKustoLib.DeltaException ; Issue parsing script
  Stack trace:     at DeltaKustoLib.CommandModel.CommandBase.ParseAndCreateCommand(String script, Boolean ignoreUnknownCommands)    
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.ToArray()
   at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1)
   at DeltaKustoLib.CommandModel.CommandBase.FromScript(String script, Boolean ignoreUnknownCommands)
   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.ToArray()
   at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1)
   at DeltaKustoIntegration.Database.ScriptDatabaseProvider.DeltaKustoIntegration.Database.IDatabaseProvider.RetrieveDatabaseAsync(CancellationToken ct)
   at delta_kusto.DeltaOrchestration.RetrieveDatabaseAsync(IDatabaseProvider currentDbProvider, String db)
   at delta_kusto.DeltaOrchestration.ProcessJobAsync(MainParameterization parameters, IKustoManagementGatewayFactory kustoGatewayFactory, IFileGateway localFileGateway, String jobName, JobParameterization job)
    Exception encountered:  DeltaKustoLib.DeltaException ; There should be one-and-only-one Property name but there are 0
    Stack trace:     at DeltaKustoLib.CommandModel.CodeHelper.GetUniqueDescendant[TElement](SyntaxElement parent, String descendantNameForExceptionMessage, Func`2 predicate)
   at DeltaKustoLib.CommandModel.CreateFunctionCommand.<>c.<GetProperties>b__23_1(SeparatedElement p)
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at DeltaKustoLib.CommandModel.CreateFunctionCommand.GetProperties(FunctionDeclaration functionDeclaration, QuotedText& folder, QuotedText& docString)
   at DeltaKustoLib.CommandModel.CreateFunctionCommand.FromCode(SyntaxElement rootElement)
   at DeltaKustoLib.CommandModel.CommandBase.CreateCommand(String script, KustoCode code, Boolean ignoreUnknownCommands)
   at DeltaKustoLib.CommandModel.CommandBase.ParseAndCreateCommand(String script, Boolean ignoreUnknownCommands)
vplauzon commented 1 year ago

This is the same issue as this one.

It is fixed and will be available in next version.

vplauzon commented 1 year ago

Fixed in 0.14.0.