Trying to get a simple sample working from the generated .net app where "mytablename" | count or "mytablename" | take 2 returns an exception "Semantic error: Scalar is not expected in the current context". I seem to be authenticating fine and cannot make any progress as expecting the sample app generated from the azure data explorer dashboard to just work.
using (var cslQueryProvider = KustoClientFactory.CreateCslQueryProvider(kustoConnectionString))
{
var query = $"df-edata-marley | count";
var results = cslQueryProvider.ExecuteQuery\<long\>(config.DatabaseName, query);
}
second test query
string query = @"df-edata-marley | take 2";
using (var response = queryClient.ExecuteQuery(configDatabaseName, query, null))
{
int columnNoStartTime = response.GetOrdinal("StartTime");
int columnNoState = response.GetOrdinal("State");
int columnNoDailyDamage = response.GetOrdinal("DailyDamage");
Console.WriteLine("Daily tornado damages over 100,000,000$:");
while (response.Read())
{
Console.WriteLine("{0}}",response.GetValue(0));
}
}
Both of these throw
[0]Kusto.Data.Exceptions.SemanticException: Semantic error: Scalar is not expected in the current context at Kusto.Data.Net.Client.KustoDataHttpClient.ThrowKustoExceptionFromResponseMessageAsync(KustoExceptionContext exceptionContext, HttpResponseMessage responseMessage, ClientRequestProperties properties, Boolean shouldBuffer, Action`2 notify, IDumper dumper) at Kusto.Data.Net.Client.RestClient2.MakeHttpRequestAsyncImpl(RestApi restApi, String address, String csl, String ns, String databaseName, Boolean streaming, ClientRequestProperties properties, ServiceModelTimeoutKind timeoutKind, String clientRequestId, Stream body, StreamProperties streamProperties, CancellationToken cancellationToken, KustoProtocolRequest request, String hostHeaderOverride) at Kusto.Cloud.Platform.Utils.MonitoredActivity.InvokeAsync\[TActivityType,TResult\](TActivityType activityType, Func`1 func, String clientRequestId) at Kusto.Cloud.Platform.Utils.MonitoredActivity.InvokeAsync\[TActivityType,TResult\](TActivityType activityType, Func\`1 func, String clientRequestId)
at Kusto.Data.Net.Client.RestClient2.MakeHttpRequestAsync(RestApi restApi, String baseAddress, String relativeAddress, String clientRequestIdPrefix, String ns, String databaseName, String csl, String addr, Boolean streaming, ClientRequestProperties properties, ServiceModelTimeoutKind timeoutKind, StreamProperties streamProperties, CancellationToken cancellationToken)
at Kusto.Data.Net.Client.RestClient2.ExecuteQueryAsync(String databaseName, String query, ClientRequestProperties properties, CancellationToken cancellationToken)
you need to escape the table/function name.
Documentation: Entity names
For example:
['df-edata-marley'] | take 2
(intead of
df-edata-marley | take 2
)