Skip to content
Advertisement

SQL Database using JDBC + parameterize SQL Query + Databricks

In Databricks am reading SQL table as

How can I parameterize SourceSystem and RuleCode in Where clause

Was referring to: https://docs.microsoft.com/en-us/azure/databricks/data/data-sources/sql-databases

Advertisement

Answer

if you import the spark implicits, you can create references to columns with the dollar $ interpolator. Also, you can use the API with columns to make the logic, it will be something like this.

As you can see, the dollar will provide a Column object, with logic like cooperation, casting renaming etc. In combination with the functions in org.apache.spark.sql.function will allow you to implement almost all you need.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement