Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredJoin us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered
Our ETL uses Fabric notebooks to extract/clean/transform big dataset into Fabric lakehouses
We want to create/update SQL Views with a lakehouse SQL endpoint. The SQL views could be created manually via lakehouse SQL endpoint query console/panel. But we want to automate View creation/update by Fabric notebook
Spark.sql() could create temprary sql views but not persistent views with SQL endpoint
We try to use ODBC/PYDOBC to connect the SQL endpoint and issue the view creattion query, which seems not working either
Please help - how to create SQL views with Fabric lakehouse SQL endpoint from Fabric notebook?
@yongshao We automate our sql views creation using 'script activity' under Data pipelines.
Thanks,
Chetna
Thanks for response
with Solved: Re: Creating views from spark notebook into SQL an... - Microsoft Fabric Community, a pipeline with script to create a view does work
I wonder why pyodbc driver connection could only query the data but cannot create views from SQL endpoint
import pyodbc
server = "?"
database = "?"
username = “?”
pwd = "?"
connection_string = f"Driver={{ODBC Driver 18 for SQL Server}};Server={server};Database={database};Authentication=ActiveDirectoryPassword;UID={username};PWD={pwd};ConnectRetryCount=4"
conn = pyodbc.connect(connection_string)
rows = conn.execute("select top(10) * from dbo.building")
for row in rows:
print(row) # works fine
#following doesn't work
conn.execute("create view dbo.testView as select top(10) * from dbo.building")
Hi @yongshao ,
Thanks for using Fabric Community.
" Spark views won't show up in the SQL endpoint. It is the same behavior with Synapse Spark too. Views created in Synapse won't show up in Synapse serverless. "
The only option left is to create the views directly in the Lakehouse's SQL Analytics Endpoint.
Similar Threads -
Re: Can you read a Fabric lakehouse view from spar... - Microsoft Fabric Community
Solved: Re: Creating views from spark notebook into SQL an... - Microsoft Fabric Community
Hope this is helpful. Please do let me know incase of further queries.
Hi @yongshao ,
We haven’t heard from you on the last response and was just checking back to see if your query was answered.
Otherwise, will respond back with the more details and we will try to help .
Thanks
Hi @yongshao ,
We haven’t heard from you on the last response and was just checking back to see if your query was answered.
Otherwise, will respond back with the more details and we will try to help .
Thanks
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
9 | |
4 | |
3 | |
3 | |
2 |