From 7fc07d08c017030618187e623472167b24e627cb Mon Sep 17 00:00:00 2001 From: Justin M <63619224+JustinMDotNet@users.noreply.github.com> Date: Fri, 30 Apr 2021 17:33:08 -0700 Subject: [PATCH] Kusto Special Character Database Fix (#1201) * Removed Parallel.Invoke from KustoIntellisenseClient.cs > LoadSchema. Added EscapeName from databaseName to LoadSchema and GetTableInfos * Reverted change to Parallel.Invoke in LoadSchema --- .../DataSource/Intellisense/KustoIntellisenseClient.cs | 7 +++---- .../DataSource/KustoDataSource.cs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.Kusto.ServiceLayer/DataSource/Intellisense/KustoIntellisenseClient.cs b/src/Microsoft.Kusto.ServiceLayer/DataSource/Intellisense/KustoIntellisenseClient.cs index 8345c056..f321caa6 100644 --- a/src/Microsoft.Kusto.ServiceLayer/DataSource/Intellisense/KustoIntellisenseClient.cs +++ b/src/Microsoft.Kusto.ServiceLayer/DataSource/Intellisense/KustoIntellisenseClient.cs @@ -44,9 +44,8 @@ namespace Microsoft.Kusto.ServiceLayer.DataSource.Intellisense var source = new CancellationTokenSource(); Parallel.Invoke(() => { - tableSchemas = - _kustoClient.ExecuteQueryAsync($".show database {databaseName} schema", source.Token, databaseName) - .Result; + var tableQuery = $".show database {KustoQueryUtils.EscapeName(databaseName)} schema"; + tableSchemas = _kustoClient.ExecuteQueryAsync(tableQuery, source.Token, databaseName).Result; }, () => { @@ -332,7 +331,7 @@ namespace Microsoft.Kusto.ServiceLayer.DataSource.Intellisense foreach (var autoCompleteItem in completion.Items) { var label = autoCompleteItem.DisplayText; - var insertText = autoCompleteItem.Kind == CompletionKind.Table + var insertText = autoCompleteItem.Kind == CompletionKind.Table || autoCompleteItem.Kind == CompletionKind.Database ? KustoQueryUtils.EscapeName(label) : label; diff --git a/src/Microsoft.Kusto.ServiceLayer/DataSource/KustoDataSource.cs b/src/Microsoft.Kusto.ServiceLayer/DataSource/KustoDataSource.cs index 4739f783..c4a9c8d7 100644 --- a/src/Microsoft.Kusto.ServiceLayer/DataSource/KustoDataSource.cs +++ b/src/Microsoft.Kusto.ServiceLayer/DataSource/KustoDataSource.cs @@ -467,7 +467,7 @@ namespace Microsoft.Kusto.ServiceLayer.DataSource CancellationTokenSource source = new CancellationTokenSource(); CancellationToken token = source.Token; - string query = $".show database {databaseName} cslschema"; + string query = $".show database {KustoQueryUtils.EscapeName(databaseName)} cslschema"; using (var reader = _kustoClient.ExecuteQuery(query, token, databaseName)) {