79538900

Date: 2025-03-27 12:51:06
Score: 1.5
Natty:
Report link

Found the answare here.

First install packages.

#r "nuget:Microsoft.DotNet.Interactive.SqlServer,*-*"

enter image description here

Then create the kernels of SQL and Python.

I use a conda environment.

#!connect mssql --kernel-name DB "Server=server_name;Database=DB_name;Integrated Security=True;TrustServerCertificate=true;"

#!connect jupyter --kernel-name python --conda-env env_prueba2 --kernel-spec python3

enter image description here

And them to share data between languages in the same notebook.

Extract from SQL Server a query.

Note the first line, the data as a name to share from SQL to Python.

enter image description here
And now it can be use with Python.

As you can see the query result save in pandas dataframe.

enter image description here

The only problem that I found is that querys result must to be small. I try share 500,000 rows and crash.

By!

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Ronald Rivera