1

I don't want to get any downloads just get stream of data which I can read using Pandas later

>! the parameters of BlobServiceClient are correctly provided
BSC= BlobServiceClient() 
self.stream = BytesIO()
BSC.get_blob_client(
            self.container, self.filename
        ).download_blob(offset=0).readinto(self.stream)

Actually I want replcaement for this below code which is using older version of azure-storage-blob

self.servivce = BlockBLobService()
self.stream = BytesIO()
self.service.get_blob_to_stream(self.container, self.filename, self.stream)
self.stream.seek(0)
wrapper = TextIOWrapper(self.stream, encoding="utf-8")
return wrapper
ar d
  • 51
  • 5
  • Your code contradicts your title. A BytesIO object is not a stream but just a file-like object over a memory buffer. How do you intend to use this? – Botje Feb 10 '23 at 08:43
  • Indeed I just found this piece of code to give a refrence of which packages I am using. Cause I didn't wanted someone to give answer using older version of Azure-storage-blob – ar d Feb 10 '23 at 10:59
  • I have updated the question with more detail – ar d Feb 10 '23 at 11:12

1 Answers1

1

From the documentation:

io.StringIO(
  BSC.get_blob_client(self.container, self.filename).content_as_text())
Botje
  • 26,269
  • 3
  • 31
  • 41