SQL Server Python tutorials

APPLIES TO: yesSQL Server (Windows only) noAzure SQL Database noAzure SQL Data Warehouse noParallel Data Warehouse

This article provides a list of tutorials and samples that demonstrate the use of Python with SQL Server 2017. Through these samples and demos, you will learn:

  • How to run Python from T-SQL
  • What are remote and local compute contexts, and how you can execute Python code using the SQL Server computer
  • How to wrap Python code in a stored procedure
  • Optimizing Python code for a SQL production environment
  • Real-world scenarios for embedding machine learning in applications

For information about requirements and setup, see Prerequisites.

Python tutorials

  • Running Python in T-SQL

    Learn the basics of how to call Python in T-SQL, using the extensibility mechanism pioneered in SQL Server 2016.

  • Create a machine learning model in Python using revoscalepy

    This lesson demonstrates how you can run code from a remote Python terminal, using SQL Server compute context. You should be somewhat familiar with Python tools and environments. Sample code is provided that creates a model using rxLinMod, from the new revoscalepy library.

  • In-Database Python analytics for SQL developers

    This end-to-end walkthrough demonstrates the process of building a complete Python solution using T-SQL stored procedures. All Python code is included.

Python samples

These samples and demos provided by the SQL Server development team highlight ways that you can use embedded analytics in real-world applications.

See also

R tutorials for SQL Server