Usually I can access Hive table from Spark by using the following:
val start = "20191009"
val end = "20200112"
val df= ss.sql(s"""select * from myTable where dat between '$start' and '$end' """)
By previous code I can pass variable to the SQL by including $
in front of the variable.
Now I want to do same previous logic but with the postgres
table.
I have Postgres table that I connected to it through:
val statement = connection.createStatement()
var gg = statement.executeQuery("update myTable set firstV='NewValue' where SecondV =$val;")
I want to pass a variable to the previous sql ( to val variable).