-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmount_storage.py
52 lines (40 loc) · 1.93 KB
/
mount_storage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Databricks notebook source
# MAGIC %md
# MAGIC ## Mount the following data lake storage gen2 containers
# MAGIC 1. raw
# MAGIC 2. transformation
# COMMAND ----------
# MAGIC %md
# MAGIC ### Set-up the configs
# MAGIC #### Please update the following
# MAGIC - application-id
# MAGIC - service-credential
# MAGIC - directory-id
# COMMAND ----------
configs = {"fs.azure.account.auth.type": "OAuth",
"fs.azure.account.oauth.provider.type": "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider",
"fs.azure.account.oauth2.client.id": "673024e7-58e2-492b-98a1-c86c654b6513", # "<application-id>"
"fs.azure.account.oauth2.client.secret": "KkR8Q~UxRusKGD-Q6BhMSkfEGq5YLzZJue5BEanH", # "<service-credential>"
"fs.azure.account.oauth2.client.endpoint": "https://login.microsoftonline.com/d5a4b356-132f-4a26-92cf-095f4ca4afc2/oauth2/token"} # "https://login.microsoftonline.com/<directory-id>/oauth2/token"
# COMMAND ----------
# MAGIC %md
# MAGIC ### Mount the raw container
# MAGIC #### Please update the following
# MAGIC - raw-container
# MAGIC - storage-account-name
# COMMAND ----------
dbutils.fs.mount(
source = "abfss://raw@walmartazuredatabricks.dfs.core.windows.net/", # "abfss://<raw-container>@<storage-account-name>.dfs.core.windows.net/"
mount_point = "/mnt/walmartazuredatabricks/raw", # "/mnt/<storage-account-name>/<raw-container>"
extra_configs = configs)
# COMMAND ----------
# MAGIC %md
# MAGIC ### Mount the transformation container
# MAGIC #### Please update the following
# MAGIC - transformation-container
# MAGIC - storage-account-name
# COMMAND ----------
dbutils.fs.mount(
source = "abfss://transformation@walmartazuredatabricks.dfs.core.windows.net/", # "abfss://<transformation-container>@<storage-account-name>.dfs.core.windows.net/"
mount_point = "/mnt/walmartazuredatabricks/transformation", # "/mnt/<storage-account-name>/<transformation-container>"
extra_configs = configs)