
Explanation:
Option C is correct. Databricks employs a security feature known as secret redaction. Any value retrieved using dbutils.secrets.get() is automatically intercepted by the notebook's output buffer and replaced with the string [REDACTED]. This prevents sensitive credentials from being accidentally exposed in the notebook UI or logged in plain text.
Crucially, this redaction only affects the display of the value. The underlying code and the Spark JDBC driver still receive the actual, unredacted secret value. Therefore, the connection to the external database will succeed as long as the secret is valid.
Why the other options are incorrect:
dbutils.secrets.get() is a programmatic API. It retrieves values from a backed secret scope (like Azure Key Vault or Databricks-backed scopes) and does not prompt the user for input.Ultimate access to all questions.
After configuring Databricks secrets to manage credentials for an external database, a data engineer executes a code snippet that retrieves a password via dbutils.secrets.get() to establish a JDBC connection. What will be the result of executing this code in a Databricks notebook?
password = dbutils.secrets.get(
scope="jdbc-secrets",
key="db-password"
)
jdbc_url = "jdbc:postgresql://host:5432/db"
df = spark.read.format("jdbc") \
.option("url", jdbc_url) \
.option("user", "db_user") \
.option("password", password) \
.option("dbtable", "public.table") \
.load()
print(password)
password = dbutils.secrets.get(
scope="jdbc-secrets",
key="db-password"
)
jdbc_url = "jdbc:postgresql://host:5432/db"
df = spark.read.format("jdbc") \
.option("url", jdbc_url) \
.option("user", "db_user") \
.option("password", password) \
.option("dbtable", "public.table") \
.load()
print(password)
A
The connection attempt to the external table will fail, and the notebook output will display the string [REDACTED].
B
An interactive prompt will appear in the notebook; if the correct password is provided, the connection succeeds and the encoded password is automatically stored in DBFS.
C
The connection to the external table will succeed, and the notebook output will display the string [REDACTED].
D
The connection to the external table will succeed, and the plain text representation of the password will be printed in the output.
E
An interactive prompt will appear in the notebook; if the correct password is provided, the connection succeeds and the password is printed in clear text.