Skip to content

JDBCOptions

JDBCOptions is the options of the JDBC data source.

batchsize

cascadeTruncate

createTableColumnTypes

createTableOptions

customSchema

dbtable

driver

fetchsize

isolationLevel

keytab

lowerBound

(only for reading) The lower bound of the partitionColumn

Must be smaller than the upperBound

Required with the partitionColumn defined

Used when:

numPartitions

The number of partitions for loading or saving data

Required with the partitionColumn defined

Only used when the difference between upperBound and lowerBound is greater than or equal to this numPartitions option. JDBCRelation prints out the following WARN message to the logs when it happens:

The number of partitions is reduced because the specified number of partitions is less
than the difference between upper bound and lower bound.
Updated number of partitions: [difference];
Input number of partitions: [numPartitions];
Lower bound: [lowerBound];
Upper bound: [upperBound].

Tip

Enable INFO logging level of the JDBCRelation logger to see what happens under the covers.

Used when:

  • DataFrameReader is requested to jdbc (and JDBCRelation utility is used to determine partitions)
  • JdbcUtils is requested to saveTable

partitionColumn

The name of the column used to partition dataset (using a JDBCPartitioningInfo). The type of the column should be one of the following (or an AnalysisException is thrown):

When specified, the other partitioned-reading properties are required:

Cannot be used with query option

When undefined, the other partitioned-reading properties should not be defined:

Used when:

  • DataFrameReader is requested to jdbc

principal

pushDownAggregate

pushDownPredicate

query

queryTimeout

refreshKrb5Config

sessionInitStatement

tableComment

truncate

upperBound

(only for reading) The upper bound of the partitionColumn

Required when the other properties are defined:

Must be larger than the lowerBound

Used when:

url

(required) A JDBC URL to use to connect to a database

Creating Instance

JDBCOptions takes the following to be created:

  • URL
  • Table (corresponds to the dbtable option)
  • Configuration Parameters