1

I'm trying to create an Azure Function that queries the adx database.

In my function I have an object that I would like to pass to the stored function in adx as the parameter.

In the function I'm using this in the in the code but getting an error and SetParameter only takes a string.

queryGetTransaction = "declare query_parameters(ID:dynamic); GetTransaction(ID)";

I set that dynamic parameter with ClientRequestProperties if "ID" is the object:

ClientRequestProperties clientRequestProperties = new ClientRequestProperties();
clientRequestProperties.SetParameter("identifiervalue", ID)

I'm getting this error:

Text=declare query_parameters(ID:dynamic); GetTransaction(ID)
SemanticErrors='ID' invalid query parameter type (expected 'dynamic)

If I'm not doing this correctly can I pass an object to the stored function and use that for parameters in the where?

  private static readonly string queryGetIDs = "declare query_parameters(idvalue:dynamic); GetIds(idvalue)";

   public async Task<List<ID>> GetIDs(ID ids)
    {
        IDataReader reader = null;
       
        var serviceUri = URL To ADX ;
        var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(serviceUri).WithAadSystemManagedIdentity();

        var client = KustoClientFactory.CreateCslQueryProvider(kustoConnectionStringBuilder);

        ClientRequestProperties clientRequestProperties = new ClientRequestProperties();
        clientRequestProperties.SetParameter("idvalue", ids);

        reader = await client.ExecuteQueryAsync("TableName", queryGetIDs, clientRequestProperties);
}
Zach
  • 19
  • 2

1 Answers1

0

I got this working

string str = JsonConvert.SerializeObject(ids);

ClientRequestProperties clientRequestProperties = new ClientRequestProperties();
 clientRequestProperties.SetParameter("value", str);

The declare query_parameters doesnt have to match the actual stored function in ADX. I ended up setting declare query_parameters to string and the stored function has dynamic. That fixed the issue.

Zach
  • 19
  • 2