Forum Discussion

ebjim's avatar
ebjim
Resolver I
1 year ago
Solved

Temporary view in a different cell

I have a temporary view created in a cell, which is called in the next cell.    %%sql   CREATE OR REPLACE TEMPORARY VIEW vtemp AS SELECT NAME, CITY  FROM table1     import com.microsoft.spa...
  • v-menakakota's avatar
    1 year ago

    Hi ebjim ,
    Thanks for reaching out to the Microsoft fabric community forum. 

    Spark notebooks commonly show this behavior when working with temporary views across multiple cells. These views are only available within the Spark session in which they were created. In Microsoft Fabric, if a new session starts (which can happen between cell executions), the temporary views are no longer available which is likely why you're seeing the “View or Table not found” error in the next cell.

    To keep things working:

    • Create and use the temporary view within the same cell, or
    • Consider using a global temporary view if you need to access it across cells or sessions.

    If you'd like more detail on how notebook execution and Spark sessions work in Fabric, this Microsoft Learn article is a great resource:
    Develop, execute, and manage notebooks - Microsoft Fabric | Microsoft Learn

    If this post was helpful, please give us Kudos and consider marking Accept as solution to assist other members in finding it more easily.
    Best Regards, 
    Menaka.
    Community Support Team