shutterstock_719332081.jpg

Fixing Azure Table Storage Column Types in Bulk

Introduction

I recently faced an issue with Azure table storage column types with date types and couldn’t find anything documented online to help resolve this issue, hence why I put this blog together; incase someone is dealing with the same problem.

Issue: Error when querying Azure Table Storage for items with dates between/after/before x to display on a dashboard using JavaScript.

After some digging, I found that the wrong dates are being fetched is because the Created and Modified date fields in the table are in String format instead of DateTime. The only way to get my queries to pull the right information was to modify all Dates in my table to the right format. You can manually change field types one at a time in Azure Table Storage but that will take forever if you have even 100+ items.

Steps to Update and Fix Azure Table Storage Column Type in Bulk

How to fix an error when querying Azure Table Storage for items with dates between/after/before x to display on a dashboard using JavaScript.

  1. Export table data

    To do this, click export in the top pane. It’ll download as a csv with “.typed.csv” extension.

  2. Understand field types

    Upon opening the excel file, you’d realize each of the fields have their respective field types next to them(“FieldName” + @type).

  3. Update the type column

    Highlight all affected rows and update the type column from Edm.String to Edm.DateTime or whatever type you need to update it to. Once complete, save file and import into Azure Table Storage.

Open one of the table records after import is complete to confirm it’s showing the right type. You can also use this process to update field values if needed.

Perry KankamFixing Azure Table Storage Column Types in Bulk

Join the conversation

This site uses Akismet to reduce spam. Learn how your comment data is processed.