pyspark.sql.SparkSession.active

classmethod SparkSession.active() → pyspark.sql.session.SparkSession[source]

Returns the active or default SparkSession for the current thread, returned by the builder.

New in version 3.5.0.

Returns
SparkSession

Spark session if an active or default session exists for the current thread.