JDBC Data Source
Spark SQL supports loading data from tables using JDBC.
As a Spark developer, you use DataFrameReader.jdbc to load data from an external table using JDBC.
1 2 3 4 5 6 7 8 |
val table = spark.read.jdbc(url, table, properties) // Alternatively val table = spark.read.format("jdbc").options(...).load(...) |
These one-liners create a DataFrame that represents the distributed process of loading data from a database and a table (with additional properties).