Well my question is if there is a way to work in SQL (in Polyglot notebook) and save tables as a objects or variables, and them go to a Python cell (in the same Polyglot notebook) to work the tables with Python.
So, as in the screen capture I would like yo share the temporary table #tmp3 and work in Python.
I'm using Polyglot v1.0.6160010 extension in VScode.
Thanks a lot for the help! By!
Well my question is if there is a way to work in SQL (in Polyglot notebook) and save tables as a objects or variables, and them go to a Python cell (in the same Polyglot notebook) to work the tables with Python.
So, as in the screen capture I would like yo share the temporary table #tmp3 and work in Python.
I'm using Polyglot v1.0.6160010 extension in VScode.
Thanks a lot for the help! By!
Share Improve this question asked Mar 19 at 20:52 Ronald RiveraRonald Rivera 333 bronze badges1 Answer
Reset to default 1Found 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!