spark.read.option(jdbc)参数

Property NameMeaning
urlThe 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方式都可以

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

版权声明:本文为kaaosidao原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。