cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

What's the difference between a Global view and a Temp view?

User15787040559
New Contributor III

The difference between Global and Temp is how the lifetime of the view is tied to the application:

http://spark.apache.org/docs/latest/api/python/reference/api/pyspark.sql.DataFrame.createOrReplaceTe...

Creates or replaces a local temporary view with this DataFrame.

The lifetime of this temporary table is tied to the SparkSession that was used to create this DataFrame.

http://spark.apache.org/docs/latest/api/python/reference/api/pyspark.sql.DataFrame.createOrReplaceGl...

Creates or replaces a global temporary view using the given name.

The lifetime of this temporary view is tied to this Spark application.

1 REPLY 1

Anand_Ladda
Honored Contributor II

In the context of Databricks Notebooks and Clusters

  • A Temp View is available across the context of a Notebook and is a common way of sharing data across various language REPL - Ex:- Python to Scala.
  • A Global Temp View is available to all Notebooks running on that Databricks Cluster
Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.