โ11-23-2022 01:40 AM
โ11-23-2022 05:00 AM
Hi @Abel Martinezโ : That is by design. The secrets won't be visible in the notebook which will be hidden.
โ11-23-2022 05:00 AM
The reason why we store credentials as databricks secrets is to protect credentials when you run your jobs / notebooks. However to avoid accidental display of these secrets, databricks redacts these secrets.
The same can be found in the below documentation.
https://docs.databricks.com/security/secrets/redaction.html
โ11-23-2022 05:04 AM
As for the second part, if you want to get those secrets, there is a workaround.
secrets = dbutils.secrets.get(scope="scopeName", key="KeyName")
for value in secrets :
print(value , end=" ")
Hope this helps..
โ11-23-2022 05:22 AM
Hi all, thanks for your feedback. I don't want to show the secrets, what I want is that Python output doesn't show spaces as [REDACTED]. I'm not printing the secrets, the text with [REDACTED] instead of spaces is the normal output for the Python notebook and exceptions.
โ11-23-2022 06:34 AM
REDACTED is a placeholder defined.
If you want to replace that in the output, for visual purposes you can do a bit of playing with the code to get there.
In the notebook cell where you are getting that output/error use the below assigning the output or error to a variable.
import sys
from IPython.utils.capture import CapturedIO
capture = CapturedIO(sys.stdout, sys.stderr)
..... <your code>
var1 = capture.stdout #use stdout or stderr as fit
When you print this var1, ideally the placeholder should be displaying as blank, but if it still displays, you can always use a .replace python function for that.
Please do let me know if this works...Cheers.
โ11-23-2022 07:05 AM
Not the solution that I was finding but it works as a workaround.
Thanks!
โ11-29-2022 12:43 PM
You can not see the secret inโ Databricks notebook. It will always show REDACTED. Even if in data you are getting same value that are same as secret then in that case you will always get REDACTED for that data.
โ11-30-2022 03:05 AM
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
โ12-16-2022 10:59 PM
Yes, obviously that you can not see the value in secret scope. That is important behavior of secret scope.
โ04-25-2023 10:00 AM
I ran into the same issue and found that the reason was that the notebook included some test keys with values of "A" and "B" for simple testing. I noticed that any string with a substring of "A" or "B" was "[REDACTED]".
โ
So, in my case, it was an easy fix ... just use less-common values for my test secrets, which meant that the silly and annoying redaction went away. Thanks to this thread for helping me realize this was the issue!
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group