Forum Discussion
create view via spark sql
- 1 year ago
Hi tareksalha ,
Thanks for reaching out to the Microsoft fabric community forum.
As you are using Lakehouse with schema enabled which is still in preview phase some of the features are not supported yet and one them is creation of views.
That is the reason for the error you are observing.
Reference for the above point: Lakehouse schemas (Preview) - Microsoft Fabric | Microsoft Learn
If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thanks and Regards
Hi tareksalha,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
- tareksalha1 year agoFrequent Visitor
hi there,
today I had the chance to test your proposed solution. I checked, that data_lake is set as the default lakehouse. Also, I checked both the workspace and lakehouse permissions and all looks good.
Unfortunately, your modified code does not work as well, but with different error:assertion failed: Only the following table types are supported: MANAGED, MATERIALIZED_VIEW scala.Predef$.assert(Predef.scala:223) com.microsoft.fabric.spark.catalog.metadata.v202405.TableMetadataManagerV202405.createTable(TableMetadataManagerV202405.scala:95) com.microsoft.fabric.spark.catalog.metadata.MetadataManager.createTable(MetadataManager.scala:235) com.microsoft.fabric.spark.catalog.metadata.InstrumentedMetadataManager.super$createTable(MetadataManager.scala:370) com.microsoft.fabric.spark.catalog.metadata.InstrumentedMetadataManager.$anonfun$createTable$1(MetadataManager.scala:370) scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) com.microsoft.fabric.spark.catalog.metadata.Helpers$.timed(Helpers.scala:61) com.microsoft.fabric.spark.catalog.metadata.InstrumentedMetadataManager.createTable(MetadataManager.scala:370) com.microsoft.fabric.spark.catalog.OnelakeExternalCatalog.createTable(OnelakeExternalCatalog.scala:102) com.microsoft.fabric.spark.catalog.InstrumentedExternalCatalog.$anonfun$createTable$3(OnelakeExternalCatalog.scala:434)Interesting fact: the view has still been created, although the command errored out. But when I try to access the view and query it, It does not open with following error:
Server Error. Message The requested Lakehouse operation failed. A retry of the operation may help. Error Code LakehouseOperationFailed Activity Id (Failed Request) e56455f1-3925-4c87-9f84-2c77507ed803 Client Session Id 8501eff4-63b3-4d6e-80a4-e030df9fdfed Activity ID (Initial Request) 764fafca-0689-474b-9935-c966480e4dc5 User session Id cdfe8c46-09c1-4048-b97c-fe26c1a1814b- v-nmadadi-msft1 year agoCommunity Support
Hi tareksalha ,
Thanks for reaching out to the Microsoft fabric community forum.
As you are using Lakehouse with schema enabled which is still in preview phase some of the features are not supported yet and one them is creation of views.
That is the reason for the error you are observing.
Reference for the above point: Lakehouse schemas (Preview) - Microsoft Fabric | Microsoft Learn
If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thanks and Regards- v-nmadadi-msft1 year agoCommunity Support
Hi tareksalha,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If our responses has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.