I'm connecting to an Azure database with the azure-sqldb library for Spark.
In the GitHub example, they define the log-in credentials in the code. I'm relatively new to Scala, and I'm used to R Studio where I can just have the GUI prompt me for passwords, eg:
password <- rstudioapi::askForPassword("Please enter your password")
Whats the best way to achieve something similar in Scala and IntelliJ? The goal is to keep login credentials away from the code, and preferably only have to enter them once per session (not every time I run the code).
Current code:
object dev extends SparkSessionWrapper {
def main(args: Array[String]): Unit = {
println(data.head())
spark.stop()
}
val statsDB = Config(Map(
"url" -> "my.database.url",
"databaseName" -> "myDB",
"dbTable" -> "myTable",
"user" -> "myLogin",
"password" -> "myPWD",
"connectTimeout" -> "600",
"queryTimeout" -> "12000"
))
val data: DataFrame = spark.read.sqlDB(statsDB)
}