spark.read.option(jdbc)参数

Property Name Meaning
url The JDBC URL to connect to. The source-specific connection properties may be specified in the URL. e.g., jdbc:postgresql://localhost/test?user=fred&password=secret
dbtable

The JDBC table that should be read from or written into. Note that when using it in the read path anything that is valid in a FROM clause of a SQL query can be used. For example, instead of a full table you could also use a subquery in parentheses. It is not allowed to specify `dbtable` and `query` options at the same time.

或者

.option("dbtable", table)

val table = "(select * from table where contiiton) as t"替换query方式都可以

query A query that will be used to read data into Spark. The specified query will be parenthesized and used as a subquery in

你可能感兴趣的:(spark)