Created
July 16, 2021 11:54
-
-
Save asonthalia/09ceba1d0a2aad927c7e4d293f14684f to your computer and use it in GitHub Desktop.
Spark Session Create
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_spark_session(): | |
''' | |
This function creates a spark session or finds an existing one and returns it | |
Parameters - none | |
Returns - spark session object | |
''' | |
spark = SparkSession \ | |
.builder \ | |
.config("spark.jars.packages", "org.apache.hadoop:hadoop-aws:2.7.0") \ | |
.config("spark.hadoop.fs.s3a.impl","org.apache.hadoop.fs.s3a.S3AFileSystem") \ | |
.getOrCreate() | |
return spark | |
spark = create_spark_session() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment