Forum Discussion
Shared SQL logic across workspace in Fabric
- 1 year ago
Hi 1maximax1,
Thanks for reaching out to Microsoft forum community.
We appreciate your efforts and thank you for sharing the update on the issue. Could you please confirm if your query has been resolved? If so, kindly mark the helpful response and accept it as the solution. This will help other community members resolve similar issues more efficiently.
Thank you.
Hi nilendraFabric ,
Thank you very much for the reply and help on this topic! I want to get more clarification for the option #1 in your response.
In option 1, when you say SQL views, do you mean the view in the screenshot below?
Question 1. I found that I can't use the view in the notebook in pyspark. Is it possible to read the view into pyspark data frame?
Question 2. When I set up shortcut from another Lakehouse, I am not able to create shortcut for the view, the only option in the shortcut it to the table or file. Is it possible to create shortcut to the views?
hello 1maximax1
you can query view using Spark SQL and load the results into a DataFrame
df = spark.sql("SELECT * FROM your_view_name")
If you need to access a view from another Lakehouse, you might need to consider this :
1. Creating a shortcut to the underlying table(s) that the view is based on.
2. Recreating the view logic in your current Lakehouse.
3. Using Spark SQL to query the view in the source Lakehouse and then working with the resulting DataFrame
Please accept this as solution and give kudos if this resolved the query