pyspark.sql.SparkSession.builder.config

builder.config(key: Optional[str] = None, value: Optional[Any] = None, conf: Optional[pyspark.conf.SparkConf] = None) → pyspark.sql.session.SparkSession.Builder

Sets a config option. Options set using this method are automatically propagated to both SparkConf and SparkSession’s own configuration.

Parameters
keystr, optional

a key name string for configuration property

valuestr, optional

a value for configuration property

confSparkConf, optional

an instance of SparkConf

Examples

For an existing SparkConf, use conf parameter.

>>> from pyspark.conf import SparkConf
>>> SparkSession.builder.config(conf=SparkConf())
<pyspark.sql.session...

For a (key, value) pair, you can omit parameter names.

>>> SparkSession.builder.config("spark.some.config.option", "some-value")
<pyspark.sql.session...