Skip to content

Instantly share code, notes, and snippets.

@htjelsma
Created October 21, 2019 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save htjelsma/a4d0e27a9afdd2fbb6aafa456f6cf7ae to your computer and use it in GitHub Desktop.
Save htjelsma/a4d0e27a9afdd2fbb6aafa456f6cf7ae to your computer and use it in GitHub Desktop.
#Get the credentials from the Keyvault that a scope was defined for using the
#Databricks CLI. See: https://docs.azuredatabricks.net/security/secrets/secret-scopes.html
#alternatively, hard-code the credentials here:
jdbcUrl = dbutils.secrets.get(scope="JDBC", key="url")
jdbcUsername = dbutils.secrets.get(scope="JDBC", key="username")
jdbcPassword = dbutils.secrets.get(scope="JDBC", key="password")
#create an object with the credentials that we can pass on to the spark dataframe reader
connectionProperties = {
"user" : jdbcUsername,
"password" : jdbcPassword,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment