How to Query Azure Table storage from Logic App | How to filter results of Azure Table storage from Logic App

{tocify} $title={Table of Contents}


Introduction

Azure Table storage is a service that stores non-relational structured data (also known as structured NoSQL data) in the cloud, providing a key/attribute store with a schemaless design.

Because Table storage is schemaless, it's easy to adapt your data as the needs of your application evolve. Access to Table storage data is fast and cost-effective for many types of applications, and is typically lower in cost than traditional SQL for similar volumes of data. 

You can use Table storage to store flexible datasets like user data for web applications, address books, device information, or other types of metadata your service requires. You can store any number of entities in a table, and a storage account may contain any number of tables, up to the capacity limit of the storage account.

Azure tables are ideal for storing structured, non-relational data.

Common uses of Table storage include:

- Storing TBs of structured data capable of serving web scale applications
- Storing datasets that don't require complex joins, foreign keys, or stored procedures and can be denormalized for fast access
- Quickly querying data using a clustered index
- Accessing data using the OData protocol and LINQ queries with WCF Data Service .NET Libraries.


Scenario

In current project, requirement was to store the records which are not Processed (due to some business condition) and needs to retried in regular intervals.

So, there was need of storage - SQL and Azure Table storage were the options. But SQL for this is too costly, so considered going with Table Storage.

In the first process(workflow) the records(whichever were not processed) were inserted in Table storage and in next scheduled process(workflow) same records were fetched and sent for processing.

Creating a Solution

For the sake of demo, will create a Azure Table storage and will add entities manually(Process 1) and later fetch them in Logic app querying it(Process 2).

Creating table in Azure storage

As can be seen in below image, tfpocazuretable is created and manually few entities are added

Adding entities in Azure Table storage


Logic app to fetch entities from Azure Table Storage 

Created a demo workflow with Recurrence trigger followed by Query Entities action.

Create Azure table storage connection from logic app


First thing is to create connection followed by selecting option to query, options available are:

Continuation Token --  The continuation token from a previous call.
Filter --  The operation only returns the values that satisfy the specified filter contitions.
Selected Properties -- Specify the list of properties to be included in result.
Top -- Top entities

 

select filter from list to query


Here Filter is selected, so all entities with all properties matching the condition is to be returned. 

If not all properties are needed, then combination of Filter and Selected properties can be used.

Filter description

Consider Filter as Where clause here, supported operators are as below
Supported operators in Filters

Went ahead with Filter alone, with Flag property equal to true
filter query with flag true

That's it. 


Testing

For testing, manually run the workflow, checked the runhistory

workflow run istory

Below is the raw output

Raw output

As can be seen in  above image, only those entities are returned which have Flag as true.


Learn More about Logic App

Post a Comment

If you have any suggestions or questions or want to share something then please drop a comment

Previous Post Next Post