I assumed that spark.sql(query) is used when we are using spark sql and that spark.read.format("jdbc").option("query", "") is used when we are using oracle sql syntax. Would I be right in assuming so?
I assumed that spark.sql(query) is used when we are using spark sql and that spark.read.format("jdbc").option("query", "") is used when we are using oracle sql syntax. Would I be right in assuming so?
Yes and Spark does more than that too!
Spark-Jdbc:
From Spark docs Jdbc(Java Database connectivity) is used to read/write data from other databases (oracle, mysql, sqlserver, postgres, db2..etc).
spark.read.format("jdbc").option("query", "(select * from <db>.<tb>)e")
Spark-Sql:
From docs Spark's module for working with structured data and lets you to query data using DataFrame API or SQL API.