pyspark.sql.SQLContext.getOrCreate#

classmethod SQLContext.getOrCreate(sc=None)[source]#

Get the existing SQLContext or create a new one with given SparkContext.

When running in Spark Connect mode, sc is not required and the active SparkSession is used automatically.

Added in version 1.6.0.

Deprecated since version 3.0.0: Use SparkSession.builder.getOrCreate() instead.

Parameters:
scSparkContext, optional

Required in classic mode; ignored in Spark Connect mode.