Ceridan

Untitled

Jan 22nd, 2021
768
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import pyarrow as pa
  2. import pyarrow.parquet as pq
  3. from azure.storage.blob import BlobServiceClient
  4.  
  5.  
  6. blob_service_client = BlobServiceClient.from_connection_string("<Azure Blob Storage Connection String>")
  7. container_client = blob_service_client.get_container_client("export")
  8.  
  9. # List blobs
  10. blobs_list = container_client.list_blobs()
  11. for blob in blobs_list:
  12.     print(blob.name + '\n')
  13.  
  14. # Download single blob
  15. blob_client = container_client.get_blob_client("<Path to particular file>")
  16. download_stream = blob_client.download_blob()
  17.  
  18. reader = pa.BufferReader(download_stream.readall())
  19. sample = pq.read_table(reader)
  20. print(sample.to_pandas())
RAW Paste Data