
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.