I created a python notebook in Azure Data Studio and it is working as intended. I saw an article about being able to run notebooks as jobs with an extension. These notebook jobs create a PowerShell script that is executed as a sql agent job. It seems as though this only works with SQL notebooks and not python notebooks based on the error I am getting. For example, I get an error message about the from clause with "from sqlalchemy import create_engine" However, the PowerShell script that was created contains the kernel and the language meta data, so it almost seems like it should work. But then again, I also don't know much at all about PowerShell.
"metadata": {
"kernelspec": {
"name": "python3",
"display_name": "Python 3 (ipykernel)",
"language": "python"
},
"language_info": {
"name": "python",
"version": "3.8.10",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
}
},
Does anyone know if this is possible? Seems like there could be a work around. It would be a game changer to be able to run python notebooks from SQL Server.
Here is a simple test I did.
I created a python notebook with
x = 5
y = "John"
print(x)
print(y)
The error I get, is exactly the same error as if you try to run that in SSMS
"Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '='. The name "x" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted. The name "y" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted"
Thanks for your time