Forum Discussion
%%tsql magic in spark notebook
- 7 months ago
HI woldea ,
You can use Spark Synapse SQL connector for your usecase.
adding same code for your reference.
# IMPORTSimport com.microsoft.spark.fabric
from com.microsoft.spark.fabric.Constants import Constants
# Code
spark.read.option(Constants.DatabaseName, "<warehouse/lakeshouse name>").synapsesql("<T-SQL Query>")
You can these docs for refernce.
https://learn.microsoft.com/en-us/fabric/data-engineering/spark-data-warehouse-connector?tabs=pyspark
Hope this helps. Let me know if you have any other questions.
Hi woldea,
Thank you for reaching out to Microsoft Fabric Community.
Thank you chetanhiwale, deborshi_nag and tayloramy for the prompt response.
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the user's for the issue worked? or let us know if you need any further assistance.
Thanks and regards,
Anjan Kumar Chippa