# pysparky.spark_configs

*module*

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L1-L1)

## pysparky.spark_configs.aws_athena_spark_config

*attribute* · *module attribute*

```python
aws_athena_spark_config = {'fs.s3a.aws.credentials.provider': 'com.amazonaws.auth.EnvironmentVariableCredentialsProvider', 'hive.metastore.client.factory.class': 'com.amazonaws.glue.catalog.metastore.AWSGlueDataCatalogHiveClientFactory', 'spark.executor.heartbeatInterval': '600s', 'spark.hadoop.fs.s3.impl': 'org.apache.hadoop.fs.s3a.S3AFileSystem', 'spark.jars.packages': 'org.apache.iceberg:iceberg-spark-runtime-3.3_2.12:1.7.11,org.apache.iceberg:iceberg-aws-bundle:1.7.12,software.amazon.awssdk:url-connection-client:2.27.213,org.apache.hadoop:hadoop-aws:3.4.14', 'spark.network.timeout': '700s', 'spark.sql.broadcastTimeout': '3600s', 'spark.sql.catalog.iceberg_catalog.catalog-impl': 'org.apache.iceberg.aws.glue.GlueCatalog', 'spark.sql.catalog.iceberg_catalog.glue.id': '123456789012', 'spark.sql.catalog.iceberg_catalog.io-impl': 'org.apache.iceberg.aws.s3.S3FileIO', 'spark.sql.catalog.iceberg_catalog.warehouse': 's3://<bucket_name>', 'spark.sql.catalog.iceberg_catalog': 'org.apache.iceberg.spark.SparkCatalog', 'spark.sql.catalog.spark_catalog.type': 'hive', 'spark.sql.catalog.spark_catalog': 'org.apache.iceberg.spark.SparkSessionCatalog', 'spark.sql.defaultCatalog': 'iceberg_catalog', 'spark.sql.extensions': 'org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions', 'spark.sql.session.timeZone': 'UTC'}
```

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L92-L110)

## pysparky.spark_configs.aws_s3_spark_config

*attribute* · *module attribute*

```python
aws_s3_spark_config = {'spark.jars.packages': 'org.apache.hadoop:hadoop-aws:3.3.1'}
```

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L112-L114)

## pysparky.spark_configs.aws_s3_tables_spark_config

*attribute* · *module attribute*

```python
aws_s3_tables_spark_config = {'spark.jars.packages': 'org.apache.iceberg:iceberg-spark-runtime-3.5_2.12:1.6.1,software.amazon.awssdk:s3tables:2.29.26,software.amazon.s3tables:s3-tables-catalog-for-iceberg:0.1.5', 'spark.sql.extensions': 'org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions', 'spark.sql.defaultCatalog': catalog_name, spark.sql.catalog.{catalog_name}: 'org.apache.iceberg.spark.SparkCatalog', spark.sql.catalog.{catalog_name}.catalog-impl: 'software.amazon.s3tables.iceberg.S3TablesCatalog', spark.sql.catalog.{catalog_name}.warehouse: 'table_bucket_arn'}
```

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L124-L131)

## pysparky.spark_configs.catalog_name

*attribute* · *module attribute*

```python
catalog_name = 's3tablescatalog/tablebucket'
```

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L123-L123)

## pysparky.spark_configs.iceberg_spark_config

*attribute* · *module attribute*

```python
iceberg_spark_config = {'spark.jars.packages': 'org.apache.iceberg:iceberg-spark-runtime-3.5_2.12:1.7.1', 'spark.sql.extensions': 'org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions', 'spark.sql.catalog.spark_catalog': 'org.apache.iceberg.spark.SparkSessionCatalog', 'spark.sql.catalog.spark_catalog.type': 'hive', 'spark.sql.catalog.local': 'org.apache.iceberg.spark.SparkCatalog', 'spark.sql.catalog.local.warehouse': './warehouse', 'spark.sql.catalog.local.type': 'hadoop'}
```

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L82-L90)

## pysparky.spark_configs.mongodb_spark_config

*attribute* · *module attribute*

```python
mongodb_spark_config = {'spark.mongodb.read.connection.uri': '<connection_string>', 'spark.mongodb.write.connection.uri': '<connection_string>', 'spark.jars.packages': 'org.mongodb.spark:mongo-spark-connector_2.12:10.4.0'}
```

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L116-L120)

## pysparky.spark_configs.AwsS3SparkConfig

*class* · *dataclass*

```python
class AwsS3SparkConfig(SparkConfigBase)
```

Bases: `pysparky.spark_configs.SparkConfigBase`

Remember to set the following env variable
    AWS_REGION=
    AWS_SECRET_ACCESS_KEY=
    AWS_ACCESS_KEY_ID=

> **Example**
>
> ```python
> >>> spark_configs = AwsS3SparkConfig().to_spark_config_map()
> >>> spark = SparkSession.builder.config(map=spark_configs).getOrCreate()
> ```

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L58-L78)

### pysparky.spark_configs.AwsS3SparkConfig.jars_packages

*attribute* · *class attribute* · *instance attribute*

```python
jars_packages: tuple[str, ...] = ('org.apache.hadoop:hadoop-aws:3.3.4')
```

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L73-L73)

### pysparky.spark_configs.AwsS3SparkConfig.to_spark_config_map

*method*

```python
def to_spark_config_map() -> dict
```

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L75-L78)

### pysparky.spark_configs.AwsS3SparkConfig.get_spark_conf

*method*

```python
def get_spark_conf() -> SparkConf
```

Inherited from: `pysparky.spark_configs.SparkConfigBase`

Return a SparkConf object based on the config map.

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L15-L19)

## pysparky.spark_configs.AwsS3TablesSparkConfig

*class* · *dataclass*

```python
class AwsS3TablesSparkConfig(SparkConfigBase)
```

Bases: `pysparky.spark_configs.SparkConfigBase`

> **Example**
>
> ```python
> >>> spark_configs = AwsS3TablesSparkConfig(
> ...     catalog_name="s3tablescatalog/tablebucket",
> ...     table_bucket_arn="arn:aws:s3tables:us-east-1:886416940696:bucket/tablebucket"
> ... ).to_spark_config_map()
> >>> spark = SparkSession.builder.config(map=spark_configs).getOrCreate()
> ```

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L23-L55)

### pysparky.spark_configs.AwsS3TablesSparkConfig.catalog_name

*attribute* · *instance attribute*

```python
catalog_name: str
```

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L36-L36)

### pysparky.spark_configs.AwsS3TablesSparkConfig.jars_packages

*attribute* · *class attribute* · *instance attribute*

```python
jars_packages: tuple[str, ...] = ('org.apache.iceberg:iceberg-spark-runtime-3.5_2.12:1.6.1', 'software.amazon.awssdk:s3tables:2.29.26', 'software.amazon.s3tables:s3-tables-catalog-for-iceberg:0.1.5')
```

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L38-L42)

### pysparky.spark_configs.AwsS3TablesSparkConfig.sql_extensions

*attribute* · *class attribute* · *instance attribute*

```python
sql_extensions: str = 'org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions'
```

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L43-L45)

### pysparky.spark_configs.AwsS3TablesSparkConfig.table_bucket_arn

*attribute* · *instance attribute*

```python
table_bucket_arn: str
```

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L37-L37)

### pysparky.spark_configs.AwsS3TablesSparkConfig.to_spark_config_map

*method*

```python
def to_spark_config_map() -> dict
```

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L47-L55)

### pysparky.spark_configs.AwsS3TablesSparkConfig.get_spark_conf

*method*

```python
def get_spark_conf() -> SparkConf
```

Inherited from: `pysparky.spark_configs.SparkConfigBase`

Return a SparkConf object based on the config map.

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L15-L19)

## pysparky.spark_configs.SparkConfigBase

*class*

```python
class SparkConfigBase(ABC)
```

Bases: `ABC`

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L9-L19)

### pysparky.spark_configs.SparkConfigBase.get_spark_conf

*method*

```python
def get_spark_conf() -> SparkConf
```

Return a SparkConf object based on the config map.

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L15-L19)

### pysparky.spark_configs.SparkConfigBase.to_spark_config_map

*method* · *abstract*

```python
def to_spark_config_map() -> Dict[str, str]
```

Return a dictionary of Spark config settings.

[View source](https://github.com/PySparky/pysparky-pyspark-helper/blob/327582f8b776fe7638082ce4b5be8153d3ce63d3/pysparky/spark_configs.py#L10-L13)
