Published on

March 13, 2020

New Feature in SQL Server: Native Python Stored Procedures

SQL Server, the popular relational database management system, is constantly evolving to meet the needs of its users. The next version of SQL Server is currently in early preview, and it brings with it a groundbreaking feature that will greatly benefit large enterprises and data scientists alike – the ability to write and compile Python functions as native stored procedures.

In the past, if you wanted to execute Python code in SQL Server, you had to embed the code in a string and submit it to the Launchpad engine. However, with this new feature, you can now write Python functions directly and have them compiled and run natively, similar to how T-SQL functions are executed.

This enhancement is being made possible through the integration of Azure Data Studio (ADS) with SQL Server. ADS is being enhanced to support the execution of Python functions, and when the code is submitted to SQL Server, the compiler will determine whether it is T-SQL or Python and pass it to the appropriate compiler.

With this new capability, you can write Python code and submit it to a SQL Server connection without the need for string manipulation. This has the potential to dramatically change the way we code in the future and will certainly make data scientists happy.

Limitations

While this new feature opens up exciting possibilities, there are some limitations to be aware of. Firstly, you can only submit a single Python function in a batch. Additionally, the module will be named “dbo” by default, which may limit its usefulness initially. It is possible that this limitation will be addressed in future releases.

Another limitation is that you can only access tables in the “dbo” schema. While this may not be an issue for many users, it could pose a challenge for those who work with schemas other than “dbo”. However, it is likely that this limitation will be resolved in future updates.

It is also worth noting that it is currently unclear whether this feature will be available in SQL Server Management Studio (SSMS). While it is not confirmed, it is unlikely that you will be able to open a Python function under the Programmability folder in Object Explorer. This functionality has not worked in early testing, and there may not be a plan to add it to SSMS.

Getting Started

If you are eager to try out this exciting new feature, you can access the early preview build of SQL Server 2019 that includes the Python compiler through the Microsoft Early Access Research program. However, please note that you will need to have a working installation of Python on your host machine to get started. The intention is to bundle a specific set of Python binaries with SQL Server in future releases.

While the story presented in this article is entirely fictional, it serves as a reminder to take breaks and find moments of levity during these stressful times. Remember to stay home, wash your hands, and prioritize your health.

We hope that this new feature in SQL Server will empower you to leverage the power of Python in your data analysis and processing tasks. Stay tuned for more updates on the exciting developments in SQL Server!

Click to rate this post!
[Total: 0 Average: 0]

Let's work together

Send us a message or book free introductory meeting with us using button below.