Found the answare here.
First install packages.
#r "nuget:Microsoft.DotNet.Interactive.SqlServer,*-*"
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
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.
And now it can be use with Python.
As you can see the query result save in pandas dataframe.
The only problem that I found is that querys result must to be small. I try share 500,000 rows and crash.
By!