Using Python in SQL Server

In the last section of this chapter, you are going to learn how to use Python with SQL Server and in SQL Server. You can use two scalable libraries, the revoscalepy and MicrosoftML libraries, which correspond to equivalent R libraries. You can also read SQL Server data by using ODBC. You can use the pyodbc package for this task. The following code imports all the necessary libraries for this section:

import numpy as np 
import pandas as pd 
import pyodbc; 
from revoscalepy import rx_lin_mod, rx_predict, rx_summary 

Now it is time to read SQL Server data. Note that like for R, I also used the ODBC Data Sources tool to create a system DSN called AWDW in advance. It points to my AdventureWorksDW2014 demo database. For ...

Get SQL Server 2017 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.