Skip to content

Commit

Permalink
Update Kusto dependencies to create correct symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
ludwhe committed Apr 21, 2023
1 parent 0430252 commit 29ada56
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<PackageReference Update="Microsoft.SqlServer.Management.SmoMetadataProvider" Version="170.12.0" />
<PackageReference Update="Microsoft.SqlServer.DacFx" Version="162.0.15-preview" />
<PackageReference Update="Microsoft.SqlServer.DacFx.Projects" Version="162.0.28-alpha" />
<PackageReference Update="Microsoft.Azure.Kusto.Data" Version="9.0.4" />
<PackageReference Update="Microsoft.Azure.Kusto.Language" Version="9.0.4" />
<PackageReference Update="Microsoft.Azure.Kusto.Data" Version="11.2.2" />
<PackageReference Update="Microsoft.Azure.Kusto.Language" Version="11.3.0" />
<PackageReference Update="Microsoft.SqlServer.Assessment" Version="[1.1.17]" />
<PackageReference Update="Microsoft.SqlServer.Migration.Assessment" Version="1.0.20230301.46" />
<PackageReference Update="Microsoft.SqlServer.Migration.Logins" Version="1.0.20230407.56" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private GlobalState LoadSchemaState(string databaseName, string clusterName)
{
IEnumerable<ShowDatabaseSchemaResult> tableSchemas = Enumerable.Empty<ShowDatabaseSchemaResult>();
IEnumerable<ShowFunctionsResult> functionSchemas = Enumerable.Empty<ShowFunctionsResult>();
var materializedViewSchemas = new ConcurrentBag<ShowMaterializedViewSchemaResult>();
var materializedViewSchemasAndQueries = new ConcurrentBag<(ShowMaterializedViewSchemaResult Schema, string Query)>();

if (!string.IsNullOrWhiteSpace(databaseName))
{
Expand All @@ -62,29 +62,29 @@ private GlobalState LoadSchemaState(string databaseName, string clusterName)

if (materializedViewSchema != null)
{
materializedViewSchemas.Add(materializedViewSchema);
materializedViewSchemasAndQueries.Add((materializedViewSchema, materializedView.Query));
}
});
});
}

return AddOrUpdateDatabase(tableSchemas, functionSchemas, materializedViewSchemas, GlobalState.Default, databaseName,
return AddOrUpdateDatabase(tableSchemas, functionSchemas, materializedViewSchemasAndQueries, GlobalState.Default, databaseName,
clusterName);
}

/// <summary>
/// Loads the schema for the specified database and returns a new <see cref="GlobalState"/> with the database added or updated.
/// </summary>
private GlobalState AddOrUpdateDatabase(IEnumerable<ShowDatabaseSchemaResult> tableSchemas,
IEnumerable<ShowFunctionsResult> functionSchemas, IEnumerable<ShowMaterializedViewSchemaResult> materializedViewSchemas,
IEnumerable<ShowFunctionsResult> functionSchemas, IEnumerable<(ShowMaterializedViewSchemaResult Schema, string Query)> materializedViewSchemasAndQueries,
GlobalState globals, string databaseName, string clusterName)
{
// try and show error from here.
DatabaseSymbol databaseSymbol = null;

if (databaseName != null)
{
databaseSymbol = LoadDatabase(tableSchemas, functionSchemas, materializedViewSchemas, databaseName);
databaseSymbol = LoadDatabase(tableSchemas, functionSchemas, materializedViewSchemasAndQueries, databaseName);
}

if (databaseSymbol == null)
Expand All @@ -96,12 +96,12 @@ private GlobalState AddOrUpdateDatabase(IEnumerable<ShowDatabaseSchemaResult> ta
if (cluster == null)
{
cluster = new ClusterSymbol(clusterName, new[] { databaseSymbol }, isOpen: true);
globals = globals.AddOrUpdateCluster(cluster);
globals = globals.AddOrReplaceCluster(cluster);
}
else
{
cluster = cluster.AddOrUpdateDatabase(databaseSymbol);
globals = globals.AddOrUpdateCluster(cluster);
globals = globals.AddOrReplaceCluster(cluster);
}

return globals.WithCluster(cluster).WithDatabase(databaseSymbol);
Expand All @@ -111,7 +111,7 @@ private GlobalState AddOrUpdateDatabase(IEnumerable<ShowDatabaseSchemaResult> ta
/// Loads the schema for the specified database into a <see cref="DatabaseSymbol"/>.
/// </summary>
private DatabaseSymbol LoadDatabase(IEnumerable<ShowDatabaseSchemaResult> tableSchemas,
IEnumerable<ShowFunctionsResult> functionSchemas, IEnumerable<ShowMaterializedViewSchemaResult> materializedViewSchemas,
IEnumerable<ShowFunctionsResult> functionSchemas, IEnumerable<(ShowMaterializedViewSchemaResult Schema, string Query)> materializedViewSchemasAndQueries,
string databaseName)
{
if (tableSchemas == null)
Expand Down Expand Up @@ -141,17 +141,17 @@ private DatabaseSymbol LoadDatabase(IEnumerable<ShowDatabaseSchemaResult> tableS
}
}

if (materializedViewSchemas != null)
if (materializedViewSchemasAndQueries != null)
{
foreach (var view in materializedViewSchemas)
foreach ((ShowMaterializedViewSchemaResult schema, string query) in materializedViewSchemasAndQueries)
{
var columns = view.Schema.Split(',')
var columns = schema.Schema.Split(',')
.Select(col =>
{
var nameType = col.Split(':');
return new ColumnSymbol(nameType[0], ScalarTypes.GetSymbol(nameType[1]));
});
var viewSymbol = new TableSymbol(view.TableName, columns);
var viewSymbol = new MaterializedViewSymbol(schema.TableName, columns, query);
members.Add(viewSymbol);
}
}
Expand Down

0 comments on commit 29ada56

Please sign in to comment.