Forum Discussion
Unable to call sparksql methods in VSCode-Fabric integrated Notebook
I'm trying to get my VSCode -> Fabric integration working. I've been through this thread many times, and it was instructive and helpful.
-- I've installed the prereqs listed in the docs, have JAVA_HOME setup, conda and java in the path
-- After installing the VSCode synapse extension, on first use it creates the two conda environments (fabric-synapse-runtime-1-1 and fabric-synapse-runtime-1-2), and on reviewing those initialization logs I see no errors
-- I can browse my workspaces and open notebooks
The problem is whenI try to use a spark command, there is a long pause (session starting in Fabric?), following by an error:
- Example 1-
%%sparksql
SELECT * FROM TableName
--
UsageError: Cell magic `%%sql` not found.
- Example 2-
[INFO ] 2024-01-26 16:52:01.963 [Thread-2] SparkContext: Running Spark version 3.4.1
[WARN ] 2024-01-26 16:52:02.013 [Thread-2] NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[INFO ] 2024-01-26 16:52:02.083 [Thread-2] ResourceUtils: ==============================================================
[INFO ] 2024-01-26 16:52:02.084 [Thread-2] ResourceUtils: No custom resources configured for spark.driver.
[INFO ] 2024-01-26 16:52:02.084 [Thread-2] ResourceUtils: ==============================================================
[INFO ] 2024-01-26 16:52:02.085 [Thread-2] SparkContext: Submitted application: Data Cloud: Spark Lighter Connection 2024-01-26 16:51:58.578904
[INFO ] 2024-01-26 16:52:02.099 [Thread-2] ResourceProfile: Default ResourceProfile created, executor resources: Map(cores -> name: cores, amount: 1, script: , vendor: , memory -> name: memory, amount: 1024, script: , vendor: , offHeap -> name: offHeap, amount: 0, script: , vendor: ), task resources: Map(cpus -> name: cpus, amount: 1.0)
[INFO ] 2024-01-26 16:52:02.104 [Thread-2] ResourceProfile: Limiting resource is cpu
[INFO ] 2024-01-26 16:52:02.105 [Thread-2] ResourceProfileManager: Added ResourceProfile id: 0
[INFO ] 2024-01-26 16:52:02.141 [Thread-2] SecurityManager: Changing view acls to: RobertKerr
[INFO ] 2024-01-26 16:52:02.143 [Thread-2] SecurityManager: Changing modify acls to: RobertKerr
[INFO ] 2024-01-26 16:52:02.143 [Thread-2] SecurityManager: Changing view acls groups to:
[INFO ] 2024-01-26 16:52:02.143 [Thread-2] SecurityManager: Changing modify acls groups to:
[INFO ] 2024-01-26 16:52:02.144 [Thread-2] SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: RobertKerr; groups with view permissions: EMPTY; users with modify permissions: RobertKerr; groups with modify permissions: EMPTY
[INFO ] 2024-01-26 16:52:02.357 [Thread-2] Utils: Successfully started service 'sparkDriver' on port 49959.
[INFO ] 2024-01-26 16:52:02.381 [Thread-2] SparkEnv: Registering MapOutputTracker
************* PySparkLighter.log ******************
- Anonymous2 years ago
Hi robkerrdm
Please note that you should use openjdk8 instead of openjdk21. Download openjdk8 and set the environment variable.
You can refer to this document for more information:
https://learn.microsoft.com/en-us/fabric/data-engineering/setup-vs-code-extension
Hope this helps. Please let me know if you have any further questions.
6 Replies
- AnonymousNot applicable
Hi robkerrdm
Thanks for using Fabric Community.
1) We only support %pip in current version, other magic commands are not supported yet.
2) Can you please confirm that the Java version which you are using is OpenJDK 8 ?
3) Select the right spark runtime version. You can set environment in notebook in the portal, if you use fabric spark 1.2, you need to choose fabric-synapse-runtime-1-2 kernel when running code in VS Code.
Hope this helps. Please let us know if you have any further questions.
- robkerrdmFrequent Visitor
Thanks for the response, nikhilan!
Below is a screen grab of my VS selection, java & conda versions and notebook selection in the portal. The openjdk is 21.0.2 LTS.
I did have 1.2 selected in both the notebook and VSCode (at the time this was the only environment in portal).
I noticed in your screen grab you're using Runtime 1.1. I added an enviroment for 1.1, selected it in Portal and VSCode, but the error is the same.
Also noticed in your screen grab you have a magic command in the cell "%%spar..." (can't read all of it). What is the rest of it, and is it required?
Last Q: you mentioned %%sql is not supported. Thanks for letting me know. This limitation isn't stated in the "current limitations" section of the docs. Are there other limitations we should know about?
Here's a grab of my notebook (portal), notebook (VSCode), versions.
Thanks!
Rob
- AnonymousNot applicable
Hi robkerrdm
Please note that you should use openjdk8 instead of openjdk21. Download openjdk8 and set the environment variable.
You can refer to this document for more information:
https://learn.microsoft.com/en-us/fabric/data-engineering/setup-vs-code-extension
Hope this helps. Please let me know if you have any further questions.
- garys12New Member
Hi Guys,
When will %%sql magic commands start working in vs code when running fabric notebooks locally?