DataFrame.
createOrReplaceTempView
Creates or replaces a local temporary view with this DataFrame.
DataFrame
The lifetime of this temporary table is tied to the SparkSession that was used to create this DataFrame.
SparkSession
>>> df.createOrReplaceTempView("people") >>> df2 = df.filter(df.age > 3) >>> df2.createOrReplaceTempView("people") >>> df3 = spark.sql("select * from people") >>> sorted(df3.collect()) == sorted(df2.collect()) True >>> spark.catalog.dropTempView("people")
New in version 2.0.