RuntimeConfig
User-facing configuration API, accessible through SparkSession.conf.
Supports Spark Connect
Options set here are automatically propagated to the Hadoop configuration during I/O.
Syntax
spark.conf.set(key, value)
spark.conf.get(key)
Properties
Property | Description |
|---|---|
| Returns all properties set in this configuration as a dict. |
Methods
Method | Description |
|---|---|
| Sets the given Spark runtime configuration property. |
| Returns the value of the configuration property for the given key. Returns |
| Resets the configuration property for the given key. |
| Returns |
Examples
Set and retrieve a configuration property:
spark.conf.set("key1", "value1")
spark.conf.get("key1")
'value1'
Retrieve a property with a default value:
spark.conf.get("non-existent-key", "my_default")
'my_default'
Unset a configuration property:
spark.conf.set("my_key", "my_value")
spark.conf.unset("my_key")
spark.conf.get("my_key")
pyspark...SparkNoSuchElementException: ... The SQL config "my_key" cannot be found...
Retrieve all configuration properties:
spark.conf.set("key1", "value1")
spark.conf.set("key2", "value2")
spark.conf.getAll
{'key1': 'value1', 'key2': 'value2'}