Medienstudio.Azure.Data.Tables.Extensions 1.2.0

.NET 6.0 .NET Standard 2.0
dotnet add package Medienstudio.Azure.Data.Tables.Extensions --version 1.2.0
NuGet\Install-Package Medienstudio.Azure.Data.Tables.Extensions -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Medienstudio.Azure.Data.Tables.Extensions" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Medienstudio.Azure.Data.Tables.Extensions --version 1.2.0
#r "nuget: Medienstudio.Azure.Data.Tables.Extensions, 1.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Medienstudio.Azure.Data.Tables.Extensions as a Cake Addin
#addin nuget:?package=Medienstudio.Azure.Data.Tables.Extensions&version=1.2.0

// Install Medienstudio.Azure.Data.Tables.Extensions as a Cake Tool
#tool nuget:?package=Medienstudio.Azure.Data.Tables.Extensions&version=1.2.0

Azure.Data.Tables Extensions

Extensions for the Azure.Data.Tables library to easier access & manipulate data inside Azure Table Storage.

With the CSV package you can easily import and export data from Azure Table Storage to CSV files.


If you use this code for backups, please test both export and import functionality and verify that the data is correct. I am not responsible for any data loss.

A backup that you didn't test is not a backup.





using Azure.Data.Tables;
using Medienstudio.Azure.Data.Tables.Extensions;

TableServiceClient tableServiceClient = new(connectionString);
TableClient tableClient = tableServiceClient.GetTableClient("tablename");

// Get all rows from the table
List<TableEntity> entities = await tableClient.GetAllEntitiesAsync<TableEntity>();  

// Get all rows by PartitionKey
List<TableEntity> entities = await tableClient.GetAllEntitiesByPartitionKeyAsync<TableEntity>("MyPartitionKey");

// Get all rows by RowKey
List<TableEntity> entities = await tableClient.GetAllEntitiesByRowKeyAsync<TableEntity>("MyRowKey");

// Get all entites where a column starts with a specific value
List<TableEntity> entities = await _tableClient.GetAllEntitiesStartingWithAsync<TableEntity>("MyColumn", "abc");

// Get first entity in table (smallest PartitionKey + RowKey)
TableEntity entity = await tableClient.GetFirstEntityAsync<TableEntity>();

// Add list of entites (with auto-batching)
List<TableEntity> entities = new(){...};
await tableClient.AddEntitiesAsync(entities);

// Delete all rows from the table
await tableClient.DeleteAllEntitiesAsync();

// Delete all rows by PartitionKey
await _tableClient.DeleteAllEntitiesByPartitionKeyAsync("123");

// Create a table if it does not exists without throwing a hidden Exception that Application Insights will track
await tableServiceClient.CreateTableIfNotExistsSafeAsync(tableName);

CSV Export / Import

The CSV package aims support Azure Table Storage data import & export support for CSV exactly as the Azure Storage Explorer and the old Azure CLI v7 does it. Therefore exported files should be importable by the Azure Storage Explorer and the package can also read exports from ASE.

using Azure.Data.Tables;
using Medienstudio.Azure.Data.Tables.CSV;

TableServiceClient tableServiceClient = new(connectionString);
TableClient tableClient = tableServiceClient.GetTableClient("tablename");

// Export all rows from the table to a CSV file
using StreamWriter writer = File.CreateText("test.csv");
await _tableClient.ExportCSVAsync(writer);

// Export all rows as CSV to Azure BLob Storage
BlobContainerClient containerClient = new(BlobConnectionString, "testcontainer");
var blobClient = containerClient.GetBlobClient("test.csv");
var stream = await blobClient.OpenWriteAsync(true, new BlobOpenWriteOptions() { HttpHeaders = new BlobHttpHeaders { ContentType = "text/csv" } });
using StreamWriter writer = new(stream);
await _tableClient.ExportCSVAsync(writer);

// Import all rows from a CSV file to the table
using StreamReader reader = new("test.csv");
await _tableClient.ImportCSVAsync(reader);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Medienstudio.Azure.Data.Tables.Extensions:

Package Downloads

An Azure.Data.Tables extension package for exporting Azure Tables as CSV for backup purposes.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 7,072 2/17/2023
1.1.2 200 2/17/2023
1.1.1 591 1/18/2023
1.1.0 247 1/11/2023
1.0.10 4,601 4/14/2022
1.0.9 397 3/30/2022
1.0.8 387 3/29/2022
1.0.7 408 3/28/2022
1.0.6 378 3/26/2022
1.0.5 478 1/20/2022
1.0.4 386 1/20/2022
1.0.3 383 1/18/2022
1.0.2 395 1/18/2022
1.0.1 374 1/18/2022
1.0.0 395 1/17/2022

Added: Safe Key Helper