Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
esobrino
Helper II
Helper II

Fabric Notebook in VS-Code '%%pyspark' not found - expectations...

Its awesome to be able to run Fabric Workspace Notebooks in VS Code!

 

I created the Notebook in a workspace ( and having the option to work with it in VS-Code I took the opportunity...   So far all looks good the "Synapse PySpark environment completted successfully..." so I am ready to go.

 

In the Notebook, the first statments worked as expected, for example:

 

df = spark.sql("SELECT * FROM LkStaging.tl_2019_us_zcta510 LIMIT 1000")
display(df.take(10))
df.dtypes

 

But the following (that works find in Fabric Notebook) failed (note that the default workspace/Lakehouse is "WsStaging/LkStaging"):

 

%%sql
select * from tl_2019_us_zcta510

 

The error stated:

 

UsageError: Cell magic '%%sql' not found.

 

Any subsequent cells that stated the target language in the same manner also fail...

 

I expected the that I don't need to massage the Notebook when is in VS-Code and that the same exact cell statements interroperate in both environment without any kind of update.

 

Your thoughts...

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @esobrino 
Apologies for the issue you have been facing. We haven't supported %%sql magic command in vscode. This is the reason why you are getting the error.
PySpark is the only language we support now. If you would like to use spark sql, you can run it via spark.sql('select * from ....').

Hope this helps. Please let me know if you have any further questions.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @esobrino 
Thanks for using Fabric Community.
At this time, we are reaching out to the internal team to get some help on this. We will update you once we hear back from them.
Thanks

Anonymous
Not applicable

Hi @esobrino 
Apologies for the issue you have been facing. We haven't supported %%sql magic command in vscode. This is the reason why you are getting the error.
PySpark is the only language we support now. If you would like to use spark sql, you can run it via spark.sql('select * from ....').

Hope this helps. Please let me know if you have any further questions.

Got it!  its no problem...  greatly appraciate the quick response/feedback.

 

Helpful resources

Announcements
FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Fabric Update Carousel

Fabric Monthly Update - March 2026

Check out the March 2026 Fabric update to learn about new features.