Forum Discussion
Temp views don't work when selecting tables with a schema name using Spark SQL
- 4 months ago
Hi homanz ,
Thanks for reaching out to Microsoft Fabric Community.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.
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.
Lakehouse Schemas (Generally Available) - Microsoft Fabric Community
For more details: Spark views in lakehouses - Microsoft Fabric | Microsoft Learn
You may also consider raising this as an enhancement request through the Fabric Ideas - Microsoft Fabric Community so the product team can review and prioritize support for this scenario in future updates.
Hope this helps. Please reach out for further assistance.
Thank you.
Hi ati_puri and deborshi_nag, thanks both for your sugguestion.
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.
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.
One solution I found is to wrap the SQL code in the PySpark createOrReplaceTempView function. It’s surprising that PySpark can somehow resolve all the schema names from different tables, but SparkSQL cannot.
Do you know if this issue will be fixed by MS soon?
Hi homanz ,
Thanks for reaching out to Microsoft Fabric Community.
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.
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.
Lakehouse Schemas (Generally Available) - Microsoft Fabric Community
For more details: Spark views in lakehouses - Microsoft Fabric | Microsoft Learn
You may also consider raising this as an enhancement request through the Fabric Ideas - Microsoft Fabric Community so the product team can review and prioritize support for this scenario in future updates.
Hope this helps. Please reach out for further assistance.
Thank you.
- v-veshwara-msft3 months ago
Community Support
Hi homanz ,
Just wanted to check if the response provided was helpful. If further assistance is needed, please reach out.
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.Thank you.
- homanz3 months ago
Advocate I
Thanks v-veshwara-msft , I raised an idea. The link is https://community.fabric.microsoft.com/t5/Fabric-Ideas/Enable-Spark-SQL-to-create-temporary-views-using-tables-with/idi-p/5182333
If anyone has experienced the same issue, please help upvote this idea. Hopefully, Microsoft will implement a solution for this.