Azure / azure-apihub-sdk

ApiHub Pro Dev SDK
MIT License
8 stars 7 forks source link

Need example of query in ListEntitiesAsync #2

Closed sandervandevelde closed 6 years ago

sandervandevelde commented 6 years ago

I added the External Table to an Azure Function as output. I managed to write a record to SqlAzure using CreateEntityAsync(record);

So the table now contains one row.

The primary key (in a Identity column) is not returned so I have to query the table for the new record. Now I try to find the record back using a query ListEntitiesAsync:

    var query = Query.Parse("SELECT * FROM mytable WHERE FieldX = false");

    //retreive table values
    var segment = await outputTable.ListEntitiesAsync(query);

    foreach (var list in segment.Items)
    {   
        log.Info(string.Format("Found: {0} {1}", list.DeviceId, list.FieldX));
    }

But whatever I use for Query (or only the Where part or just some random text), that one record is returned and never zero rows.

Please add documentation with query example or the structure of a query.

And I feel like my query is just ignored. Even rubbish text gives the same output....

EhRom commented 6 years ago

The queries are expressed in ODATA, not in SQL.

Here is a sample :

var filter = "FieldX eq false";
var query = Query.Parse($"$top={batchSize}&$orderby={fieldName}&$filter={filter}");
sandervandevelde commented 6 years ago

Thanks, this is working in my environment