Hello dear developers,
Im facing the issue that I can not read/reach my blob file on my Azure storage account. I use C# as programming language. In the end I want to read my blob file to search for a specific value and check that if its true. Thank you in advance <3
This is how my code looks like.
//Get a reference to the edc(1.3) container
string containerName = "edc/rchexport/rch-bu-party-dd/1.3";
string connectionString = "DefaultEndpointsProtocol=https;AccountName=adlse3.....";
Log.Information($"C# Timer trigger function executed at: {DateTime.Now}");
BlobContainerClient blobContainerClient = new BlobContainerClient(connectionString, containerName);
//Acces to parquet blob file. Getting the sample structure of the blob to create the final table.
string edcRchBuParty = "rchtestdata.parquet";
BlobClient st5BobClient = blobContainerClient.GetBlobClient(edcRchBuParty);
var sampleStream = st5BobClient.OpenRead(); **<<<<<<<<< This where the error pops up**.
var sampleReader = new ParquetReader(sampleStream);
Table sampleTable = sampleReader.ReadAsTable();
DataField[] datafields = sampleTable.Schema.GetDataFields();
Table finalTable = new Table(datafields);
//looping through the container for getting the blobs and read the file and add the rows to the final table
await foreach (BlobItem blobItem in blobContainerClient.GetBlobsAsync())
{
if (blobItem.Name.Contains("15b0251556c74fd693ca1f3cb4ce4d6e")) //for testing
{
Log.Information("\t" + blobItem.Name);
BlobClient blobClient = blobContainerClient.GetBlobClient(blobItem.Name);
var stream = blobClient.OpenRead();
var reader = new ParquetReader(stream);
Table table = reader.ReadAsTable();
Console.WriteLine("Step 3 : Check");
foreach (Row row in table)
{
finalTable.Add(row);
}
Log.Information(finalTable.Count.ToString());
}