pyspark.sql.DataFrame.registerTempTable¶
-
DataFrame.registerTempTable(name)[source]¶ Registers this
DataFrameas a temporary table using the given name.The lifetime of this temporary table is tied to the
SparkSessionthat was used to create thisDataFrame.New in version 1.3.0.
Deprecated since version 2.0.0: Use
DataFrame.createOrReplaceTempView()instead.Examples
>>> df.registerTempTable("people") >>> df2 = spark.sql("select * from people") >>> sorted(df.collect()) == sorted(df2.collect()) True >>> spark.catalog.dropTempView("people")