How to pass Azure blob file path url in ChoParquetReader method?

269 Views Asked by At

As per the link, i'm able to pass parquet file from my local folder and able to convert the data into json format. Below is sample code

MemoryStream jsonMs = new MemoryStream();
using (var r = new ChoParquetReader(FILE_NAME))
                {
                    using (var w = new ChoJSONWriter(jsonMs))
                        w.Write(r);
                }

Could any one help me out on how to pass file path which is present in Azure blob? Thanks in advance.

1

There are 1 best solutions below

0
Cinchoo On

As ChoParquetReader accepts any memorystream as input, just open Azure blob for read and pass it to reader.

for your reference, this sample may helps

BlobServiceClient blobServiceClient = new BlobServiceClient("connectionString");
var desContainer = blobServiceClient.GetBlobContainerClient("containerName");
var desBlob= desContainer.GetBlockBlobClient("PARQUET file");

using (var outStream = await desBlob.OpenReadAsync(true).ConfigureAwait(false))
using (ChoParquetReader parser = new ChoParquetReader(outStream))
{
}

PS: code is not tested.