SQL Server 2017 Python tutorials

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

This article describes the Python tutorials for in-database analytics on SQL Server 2017 Machine Learning Services.

  • Learn how to wrap and run Python code in stored procedures.
  • Serialize and save Python-based models to SQL Server databases.
  • Learn about remote and local compute contexts, and when to use them.
  • Explore the Microsoft Python modules for data science and machine learning tasks.

Python quickstarts and tutorials

Link Description
Quickstart: "Hello world" Python script in SQL Server Learn the basics of how to call Python in T-SQL.
Quickstart: Create, train, and use a Python model with stored procedures in SQL Server Explains the mechanics of embedding Python code in a stored procedure, providing inputs, and stored procedure execution.
Tutorial: Create a model using revoscalepy Demonstrates how to 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.
Tutorial: Learn 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.

Code samples

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

Link Description
Build a predictive model using Python and SQL Server Learn how a ski rental business might use machine learning to predict future rentals, which helps the business plan and staff to meet future demand.
Perform customer clustering using Python and SQL Server Learn how to use the Kmeans algorithm to perform unsupervised clustering of customers.

See also