在Spark 2.x的JDBC中设置fetchSize? [英] set fetchSize in JDBC in Spark 2.x?

查看:417
本文介绍了在Spark 2.x的JDBC中设置fetchSize?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

fetchSize错误:

fetchSize error:

TypeError:jdbc()得到了意外的关键字参数'fetchSize'

TypeError: jdbc() got an unexpected keyword argument 'fetchSize'

我尝试以

mydf = spark.read.jdbc(url, table, numPartitions=20, column=partitionColumn, lowerBound=0, upperBound=1000, fetchSize = 10000, properties=properties)

推荐答案

我不确定性能,但请尝试以下代码.这不会引发错误

I am not sure of performance but try this below code. this will not throw error

df = (spark.read.format("jdbc").option("url", url)
  .option("dbtable", "mytable") 
  .option("user", user) .option("password", password) 
  .option("numPartitions", "100").option("fetchsize","10000")
  .option("partitionColumn", "id")
  .option("lowerBound", "1").option("upperBound","1000000").load())

这篇关于在Spark 2.x的JDBC中设置fetchSize?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆