<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Temp views don't work when selecting tables with a schema name using Spark SQL in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Temp-views-don-t-work-when-selecting-tables-with-a-schema-name/m-p/5180358#M16163</link>
    <description>&lt;P&gt;I created a new temporary view using Spark SQL. Code is below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CREATE&lt;/SPAN&gt; &lt;SPAN&gt;OR&lt;/SPAN&gt; &lt;SPAN&gt;REPLACE&lt;/SPAN&gt; &lt;SPAN&gt;TEMPORARY&lt;/SPAN&gt; &lt;SPAN&gt;VIEW&lt;/SPAN&gt;&lt;SPAN&gt; tmpvw1 &lt;/SPAN&gt;&lt;SPAN&gt;AS&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SELECT&lt;/SPAN&gt; &lt;SPAN&gt;*&lt;/SPAN&gt; &lt;SPAN&gt;FROM&lt;/SPAN&gt;&lt;SPAN&gt; IM.test&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;In next step, I tried to select the temp view&amp;nbsp;tmpvw1 using the following code:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SELECT&lt;/SPAN&gt; &lt;SPAN&gt;*&lt;/SPAN&gt; &lt;SPAN&gt;FROM&lt;/SPAN&gt;&lt;SPAN&gt; tmpvw1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;Then, I got this error:&lt;/P&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Error&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class=""&gt;[TABLE_OR_VIEW_NOT_FOUND] The table or view `IM`.`test` cannot be found. Verify the spelling and correctness of the schema and catalog. If you did not qualify the name with a schema, verify the current_schema() output, or qualify the name with the correct schema and catalog. To tolerate the error on drop use DROP VIEW IF EXISTS or DROP TABLE IF EXISTS. SQLSTATE: 42P01; line 1 pos 14; 'Project [upcast(getviewcolumnbynameandordinal(`tmpvw1`, new_column, 0, 1), StringType) AS new_column#690, upcast(getviewcolumnbynameandordinal(`tmpvw1`, TestCol, 0, 1), StringType) AS TestCol#691] +- 'Project [*] +- 'UnresolvedRelation [IM, test], [], false"&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Temp views seem to work fine when I only use tables in the dbo schema and don't specify the schema name. For example, SELECT * from tableA. Temp views start to fail when I add a schema name to tables. I often need to join tables in different schemas. Is it a bug in temp view? how to fix it? Thanks!&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Sun, 10 May 2026 08:34:00 GMT</pubDate>
    <dc:creator>homanz</dc:creator>
    <dc:date>2026-05-10T08:34:00Z</dc:date>
    <item>
      <title>Temp views don't work when selecting tables with a schema name using Spark SQL</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Temp-views-don-t-work-when-selecting-tables-with-a-schema-name/m-p/5180358#M16163</link>
      <description>&lt;P&gt;I created a new temporary view using Spark SQL. Code is below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CREATE&lt;/SPAN&gt; &lt;SPAN&gt;OR&lt;/SPAN&gt; &lt;SPAN&gt;REPLACE&lt;/SPAN&gt; &lt;SPAN&gt;TEMPORARY&lt;/SPAN&gt; &lt;SPAN&gt;VIEW&lt;/SPAN&gt;&lt;SPAN&gt; tmpvw1 &lt;/SPAN&gt;&lt;SPAN&gt;AS&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SELECT&lt;/SPAN&gt; &lt;SPAN&gt;*&lt;/SPAN&gt; &lt;SPAN&gt;FROM&lt;/SPAN&gt;&lt;SPAN&gt; IM.test&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;In next step, I tried to select the temp view&amp;nbsp;tmpvw1 using the following code:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SELECT&lt;/SPAN&gt; &lt;SPAN&gt;*&lt;/SPAN&gt; &lt;SPAN&gt;FROM&lt;/SPAN&gt;&lt;SPAN&gt; tmpvw1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;Then, I got this error:&lt;/P&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Error&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class=""&gt;[TABLE_OR_VIEW_NOT_FOUND] The table or view `IM`.`test` cannot be found. Verify the spelling and correctness of the schema and catalog. If you did not qualify the name with a schema, verify the current_schema() output, or qualify the name with the correct schema and catalog. To tolerate the error on drop use DROP VIEW IF EXISTS or DROP TABLE IF EXISTS. SQLSTATE: 42P01; line 1 pos 14; 'Project [upcast(getviewcolumnbynameandordinal(`tmpvw1`, new_column, 0, 1), StringType) AS new_column#690, upcast(getviewcolumnbynameandordinal(`tmpvw1`, TestCol, 0, 1), StringType) AS TestCol#691] +- 'Project [*] +- 'UnresolvedRelation [IM, test], [], false"&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Temp views seem to work fine when I only use tables in the dbo schema and don't specify the schema name. For example, SELECT * from tableA. Temp views start to fail when I add a schema name to tables. I often need to join tables in different schemas. Is it a bug in temp view? how to fix it? Thanks!&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 10 May 2026 08:34:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Temp-views-don-t-work-when-selecting-tables-with-a-schema-name/m-p/5180358#M16163</guid>
      <dc:creator>homanz</dc:creator>
      <dc:date>2026-05-10T08:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Temp views don't work when selecting tables with a schema name using Spark SQL</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Temp-views-don-t-work-when-selecting-tables-with-a-schema-name/m-p/5180438#M16165</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/93555"&gt;@homanz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Fabric relies on an internal session database for Spark session and lakehouse binding. If you run &lt;I&gt;SELECT current_database() as current_db,&lt;/I&gt; you'll notice a temporary database name appears.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To resolve this, always use a four-part name with backticks—`&amp;lt;Your Workspace Name&amp;gt;`.Lakehouse.Schema.Table—when referencing tables. You can find your schema's namespace by running the SQL below and checking the "namespace" column.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;I&gt;SHOW TABLES in IM;&lt;/I&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 May 2026 15:45:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Temp-views-don-t-work-when-selecting-tables-with-a-schema-name/m-p/5180438#M16165</guid>
      <dc:creator>deborshi_nag</dc:creator>
      <dc:date>2026-05-10T15:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Temp views don't work when selecting tables with a schema name using Spark SQL</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Temp-views-don-t-work-when-selecting-tables-with-a-schema-name/m-p/5180504#M16167</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/93555"&gt;@homanz&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are known issues and solution have bene provided in this Fabric Community before for the same issue. Pls find the link here:&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/Data-Science/Issue-with-SparkSQL-Schema-Behavior-in-Fabric/m-p/4880890#M924" target="_blank"&gt;Solved: Re: Issue with SparkSQL Schema Behavior in Fabric - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;For more details on information around Lakehouse Schema behaviour, pls find the link below.&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-engineering/lakehouse-schemas" target="_blank"&gt;Lakehouse schemas - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ati Puri&lt;/P&gt;</description>
      <pubDate>Sun, 10 May 2026 20:41:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Temp-views-don-t-work-when-selecting-tables-with-a-schema-name/m-p/5180504#M16167</guid>
      <dc:creator>ati_puri</dc:creator>
      <dc:date>2026-05-10T20:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Temp views don't work when selecting tables with a schema name using Spark SQL</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Temp-views-don-t-work-when-selecting-tables-with-a-schema-name/m-p/5180523#M16168</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1261793"&gt;@ati_puri&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1445078"&gt;@deborshi_nag&lt;/a&gt;,&amp;nbsp;thanks both for your sugguestion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the schema name works only for joining tables within a single schema, but we have tables from different schemas. So, this solution won’t work for us.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the full four-part table name also works, but we have to parameterise the workspace name in all our SQL code for CI/CD deployment, which makes the code very messy and hard to read.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One solution I found is to wrap the SQL code in the PySpark &lt;EM&gt;createOrReplaceTempView&amp;nbsp;&lt;/EM&gt;function. It’s surprising that PySpark can somehow resolve all the schema names from different tables, but SparkSQL cannot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%%pyspark&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;spark&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;sql&lt;/SPAN&gt;&lt;SPAN&gt;("""&lt;/SPAN&gt;&lt;/DIV&gt;--insert SQL code below&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;SELECT&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; *&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; IM.test t1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;left&lt;/SPAN&gt; &lt;SPAN&gt;join&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ref.testref t2&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;on&lt;/SPAN&gt;&lt;SPAN&gt; t1.key= t2.key&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;""").&lt;/SPAN&gt;&lt;SPAN&gt;createOrReplaceTempView&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"tmp_python_view"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know if this issue will be fixed by MS soon?&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2026 00:03:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Temp-views-don-t-work-when-selecting-tables-with-a-schema-name/m-p/5180523#M16168</guid>
      <dc:creator>homanz</dc:creator>
      <dc:date>2026-05-11T00:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Temp views don't work when selecting tables with a schema name using Spark SQL</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Temp-views-don-t-work-when-selecting-tables-with-a-schema-name/m-p/5181987#M16204</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/93555"&gt;@homanz&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thanks for reaching out to Microsoft Fabric Community.&lt;/P&gt;
&lt;P data-start="0" data-end="244"&gt;At the moment, this appears to be the current behavior of Spark SQL in schema enabled Lakehouses rather than an issue that can be resolved through an immediate hotfix. The PySpark approach you identified is currently the recommended workaround.&lt;/P&gt;
&lt;P data-start="0" data-end="244"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="246" data-end="439"&gt;Microsoft has also indicated that schema enabled Lakehouses in Spark still have some limitations, with additional support and improvements expected to roll out gradually over the coming months.&lt;/P&gt;
&lt;P data-start="246" data-end="439"&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Fabric-Updates-Blogs/Lakehouse-Schemas-Generally-Available/ba-p/5172416" target="_blank"&gt;Lakehouse Schemas (Generally Available) - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P data-start="246" data-end="439"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="246" data-end="439"&gt;For more details:&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-engineering/lakehouse-spark-views?source=recommendations" target="_blank"&gt;Spark views in lakehouses - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P data-start="246" data-end="439"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="441" data-end="695" data-is-last-node="" data-is-only-node=""&gt;You may also consider raising this as an enhancement request through the &lt;A href="https://community.fabric.microsoft.com/t5/Fabric-Ideas/idb-p/fbc_ideas" target="_blank"&gt;Fabric Ideas - Microsoft Fabric Community&lt;/A&gt;&amp;nbsp;so the product team can review and prioritize support for this&amp;nbsp;scenario in future updates.&lt;/P&gt;
&lt;P data-start="441" data-end="695" data-is-last-node="" data-is-only-node=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="441" data-end="695" data-is-last-node="" data-is-only-node=""&gt;Hope this helps. Please reach out for further assistance.&lt;BR /&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2026 09:42:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Temp-views-don-t-work-when-selecting-tables-with-a-schema-name/m-p/5181987#M16204</guid>
      <dc:creator>v-veshwara-msft</dc:creator>
      <dc:date>2026-05-13T09:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Temp views don't work when selecting tables with a schema name using Spark SQL</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Temp-views-don-t-work-when-selecting-tables-with-a-schema-name/m-p/5184248#M16245</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/93555"&gt;@homanz&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Just wanted to check if the response provided was helpful. If further assistance is needed, please reach out.&lt;BR /&gt;&lt;BR /&gt;If you have submitted this as an idea in the Ideas Portal, please feel free to share the link here so others in the community can upvote it. With enough support, Microsoft may consider it for future implementation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2026 04:16:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Temp-views-don-t-work-when-selecting-tables-with-a-schema-name/m-p/5184248#M16245</guid>
      <dc:creator>v-veshwara-msft</dc:creator>
      <dc:date>2026-05-18T04:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Temp views don't work when selecting tables with a schema name using Spark SQL</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Temp-views-don-t-work-when-selecting-tables-with-a-schema-name/m-p/5184253#M16246</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/882993"&gt;@v-veshwara-msft&lt;/a&gt;&amp;nbsp;, I raised an idea. The link is&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/Fabric-Ideas/Enable-Spark-SQL-to-create-temporary-views-using-tables-with/idi-p/5182333" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Fabric-Ideas/Enable-Spark-SQL-to-create-temporary-views-using-tables-with/idi-p/5182333&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone has experienced the same issue, please help upvote this idea. Hopefully, Microsoft will implement a solution for this.&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2026 04:27:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Temp-views-don-t-work-when-selecting-tables-with-a-schema-name/m-p/5184253#M16246</guid>
      <dc:creator>homanz</dc:creator>
      <dc:date>2026-05-18T04:27:02Z</dc:date>
    </item>
  </channel>
</rss>

