Export Data From Azure Table Storage to CSV

Posted on Posted in Data & Business Intelligence

While I was testing Azure Table Storage to see if that is a good fit for one of our projects, I was looking for a script to export table’s data into a CSV.

Since I could not find one, I’m publishing the (simple) script I did.

In the script I defined the table name I wanted to export.

The script is for Python 3.x and you need to install the Azure SDK:
Please note that you can install specific package (ex: azure-mgmt-storage) but in this example I installed everything:

This is the Python script:

The type of a_row is class

From Azure Storage Table Python documentations:

An entity object. Can be accessed as a dict or as an obj. The attributes of the entity will be created dynamically. For example, the following are both valid:

entity = Entity()
entity.a = ‘b’
entity[‘x’] = ‘y’

I had a problem to write columns which were defined as int, since the query entities returns these values as

so I added the if statement inside the second for loop to extract the value out of EntityProperty in case there’s one.

Leave a Reply

Your email address will not be published. Required fields are marked *