sparkContext
Returns the underlying SparkContext.
Syntax
sparkContext
Returns
SparkContext
Examples
Serverless compatibility
spark.sparkContext is not available on Databricks Serverless compute. Use the spark (SparkSession) APIs directly: for example, spark.createDataFrame(...) in place of spark.sparkContext.parallelize(...).
Python
spark.sparkContext
# <SparkContext master=... appName=...>
# Create an RDD from the Spark context.
rdd = spark.sparkContext.parallelize([1, 2, 3])
rdd.collect()
# [1, 2, 3]