Create Mnt Dbrix to Azure Storage
Tue Jul 23 2024 15:33:20 GMT+0000 (Coordinated Universal Time)
Saved by
@knguyencookie
#python
import sys
sys.path.append ('/Workspace/Users/khoa.nguyen@houstontexans.com/production_jobs/Data_Ops_Tools/')
import EnvVars
from EnvVars import *
dev_credentials = env_vars_dict['azure_storage_dev']
from azure.storage.blob import BlobServiceClient , BlobClient
# Replace the following variables with your Azure Storage account and container information
storage_account_name = dev_credentials['accountName']
storage_account_key = dev_credentials['secretValue']
container_name = "raw"
directory_name = "PSL/" # Leave empty to list files from the root of the container
mount_name = 'PSL'
directory_path = 'PSL'
dbutils.fs.mount(
source=f"wasbs://{container_name}@{storage_account_name}.blob.core.windows.net/{directory_path}",
mount_point=f"/mnt/azure_storage/{mount_name}",
extra_configs={
f"fs.azure.account.key.{storage_account_name}.blob.core.windows.net": storage_account_key
}
)
# List all mount points
mounts = dbutils.fs.mounts()
content_copyCOPY
Comments