Medienstudio.Azure.Data.Tables.CSV
1.0.0
See the version list below for details.
dotnet add package Medienstudio.Azure.Data.Tables.CSV --version 1.0.0
NuGet\Install-Package Medienstudio.Azure.Data.Tables.CSV -Version 1.0.0
<PackageReference Include="Medienstudio.Azure.Data.Tables.CSV" Version="1.0.0" />
paket add Medienstudio.Azure.Data.Tables.CSV --version 1.0.0
#r "nuget: Medienstudio.Azure.Data.Tables.CSV, 1.0.0"
// Install Medienstudio.Azure.Data.Tables.CSV as a Cake Addin #addin nuget:?package=Medienstudio.Azure.Data.Tables.CSV&version=1.0.0 // Install Medienstudio.Azure.Data.Tables.CSV as a Cake Tool #tool nuget:?package=Medienstudio.Azure.Data.Tables.CSV&version=1.0.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.
NOTE
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.
NuGet
Querying
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
CreateTestData();
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 | Versions 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. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.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. |
-
.NETStandard 2.0
- Azure.Data.Tables (>= 12.8.0)
- CsvHelper (>= 30.0.1)
- Medienstudio.Azure.Data.Tables.Extensions (>= 1.2.0)
-
net6.0
- Azure.Data.Tables (>= 12.8.0)
- CsvHelper (>= 30.0.1)
- Medienstudio.Azure.Data.Tables.Extensions (>= 1.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.