Microsoft Fabric Updates Blog

Connect to your SQL database in Fabric using Python Notebook

Read/Write to SQL database in Fabric using Python Notebook

You created your SQL database in Fabric because you wanted to take full advantage of all the existing workloads without worrying about integration pain points. Python notebook integration with SQL was highly requested. We are thrilled to share you can seamlessly use a python notebook to connect to SQL database in Fabric with the help of T-SQL Magic command. This command allows users to harness the full power of Transact-SQL (T-SQL) in ways that were previously unimaginable, blending advanced scripting with intuitive workflows, automation, and seamless integration across the Fabric data platform.

Key benefits of using Notebook for SQL database

  • Notebook-Style Querying: Interact with your SQL Database using enriched notebooks—combine queries, visualizations, and explanatory text in a single, shareable document.
  • Built-in Visualization: Instantly visualize query results using rich, interactive charts and graphs—no need to export data to external tools.
  • Automation and Scheduling: Schedule routine jobs, automate data refreshes, and trigger notifications directly from T-SQL scripts, putting operational control at your fingertips.
  • Collaboration and Sharing: Share live T-SQL notebooks with peers, embed results in reports, and collaborate in real-time within the Fabric workspace.
  • Secure by Design: Leverage Fabric’s enterprise-grade security.

Getting Started:

  1. Create a new notebook in your workspace.
  2. Change the language to Python.

A screenshot of a computer

AI-generated content may be incorrect.

3. Change the cell type to T-SQL.

A screenshot of a computer

AI-generated content may be incorrect.4. Add “%%tsql -artifact <databasename> -type SQLDatabase” before your T-SQL and hit run. 

 

A screenshot of a computer

AI-generated content may be incorrect.

This is our first step to connecting python notebook with SQL database in Fabric. There’s more on the way stay tuned for more.

Please try this new functionality and share your feedback on Fabric Ideas and join the conversation on the Fabric Community.

To Learn more about this preview feature check out Run T-SQL code in Fabric Python notebooks – Microsoft Fabric | Microsoft Learn

To get into the technical details, head over to the Fabric documentation

Entradas de blog relacionadas

Connect to your SQL database in Fabric using Python Notebook

enero 28, 2026 por Katie Murray

If you’ve been trying to keep up with everything shipping in Microsoft Fabric, this January 2026 round-up is for you—covering the biggest updates across the platform, from new AI-powered catalog experiences and OneLake governance improvements to enhancements in Data Engineering, Data Warehouse, Real-Time Intelligence, and Data Factory. If you haven’t already, make sure FabCon Atlanta … Continue reading “Fabric January 2026 Feature Summary”

enero 22, 2026 por Anna Hoffman

The SQL community is gathering in Atlanta this March for the first‑ever SQLCon, co‑located with FabCon, the Microsoft Fabric Community Conference, March 16-20. One registration unlocks both events, giving you access to deep SQL expertise and the latest in Fabric, Power BI, data engineering, real‑time intelligence, and AI. Whether you’re a DBA, developer, data engineer, architect, or a … Continue reading “Five Reasons to attend SQLCon”