Even though secrets are for masking confidential information, I need to see the value of the secret to using it outside Databricks. When I simply print the secret it shows [REDACTED].
print(dbutils.secrets.get(scope="myScope", key="myKey"))
Out:
[REDACTED]
How can I print the secret value?
CodePudding user response:
Databricks redacts secret values that are read using dbutils.secrets.get()
. When displayed in notebook cell output, the secret values are replaced with [REDACTED]
.
Although it is not recommended, there is a workaround to see actual value with a simple for loop
trick. So, you will get the value separated by spaces.
value = dbutils.secrets.get(scope="myScope", key="myKey")
for char in value:
print(char, end=" ")
Out:
y o u r _ v a l u e