Azure Tables are ideal for storing structured, non-relational data. This makes it useful in scenarios like storing a large set of user data for the web application, device information, and service related metadata.
After a while, there may be a need to reduce table size by clearing old entities. Or there may be a need to delete entities that meet a specific condition. Here is where the Serverless360 Automated task for Storage Accounts can help.
This capability is not found both in the Azure portal and in the Storage Explorer. Serverless360 fills this gap with the capability to automate the process of clearing entities from Table Storage.
Deleting Storage Account Table Entities
An associated Storage Account Table's entities can be purged using Inline or Scheduled Automated Task. Entities can be purged by specifying at least one of the following:
- Filter Query
Deleting based on Timestamp
If the entities are required to be purged based on their added time, users can use the Delete Entities Created At or Before option. The entities added at or before the specified time will be purged by the Automated task.
The selected Storage account table's entities can also be purged by adding a Filter Query. Default properties like PartitionKey, RowKey, Timestamp, and User properties can also generate a query filter. After adding the filter, Validate it to continue configuring the Automated task.
The Filter Query conforms to the OData Protocol Specification.
• Use DateTime 'ISO date-time formatted string' for the value of type DateTime. Alternately users can also use DateTime 'dd/MM/yyyy HH:mm:ss', which will be converted to ISO format by the Automated Task before performing query operation. Provide a local time when using DateTime 'dd/MM/yyyy HH:mm:ss' as the Automated task converts it to UTC before performing query operation.
• Use guid'Your 128-bit Guid' for the value of type Guid
• Use suffix L after the value of type Int64
• Use true or false for value of type Boolean.
• Use single quotes for the value of type string, and replace any single quote within the string with two consecutive single quotes.
Supported Comparison Operators
|Less than or Equal||le|
|Greater than or Equal||ge|
Supported Binary Operators
Sample Filter Query strings
- PartitionKey eq 'PartitionKey' and RowKey eq 'RowKey'
- PartitionKey ne 'PartitionKey' or not IsActive
- PartitionKey eq 'PartitionKey' and ( UserKey lt 10 or datetime'25/09/2020 10:30:00' )
- UserKey eq 'Device''s Info'