1
votes

I am trying to ingest my application log data to Azure Data Explorer using Kusto.Data NuGet (C#). I am able to retrieve data using the below method but it's not working while retrieving data. Am I using the wrong pattern for insert query?

var kustoConnectionStringBuilder =
            new KustoConnectionStringBuilder(kustoUri, database)
            {
                FederatedSecurity = true,
                InitialCatalog = database,
                UserID = user,
                Password = password,
                Authority = tenantId
            };
            var client = KustoClientFactory.CreateCslQueryProvider(kustoConnectionStringBuilder);
            string query = "ingest inline into table Device <| 1,DeviceId";
            client.ExecuteQuery(query);

Error Message: Syntax error: Query could not be parsed: A recognition error occurred. Can anyone please help me on this? My Device table has two column for now: Id (int),Description (string)

1

1 Answers

1
votes

there are several issues with the code snippet you've published:

a. you're using an ICslQueryProvider instead of an ICslAdminProvider, and ExecuteQuery() instead of ExecuteControlCommand(). .ingest (or anything else that starts with a dot (.) is a control command: https://docs.microsoft.com/en-us/azure/kusto/management/#differentiating-control-commands-from-queries)

b. you're missing a dot (.) before ingest (should be .ingest).

c. you're using direct ingestion instead of queued ingestion (it's 'ok', as long as you understand this is for test purposes only). read more here: https://docs.microsoft.com/en-us/azure/kusto/management/data-ingestion/#ingestion-methods