Tutorial: Publish an R function as a SQL Server stored procedure with the sqlrutils package
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
In SQL Server 2016 and later, you can publish an R function to the database as a stored procedure. This makes it possible to run your R function on the SQL Server itself, which makes the power of that server available for R computations, and also eliminates the time required to move data to and from the server. It also makes your R function available as a resource to DBAs for use in SQL queries, even if they don't know the R language.
Neils Berglund recently posted a detailed tutorial on using the sqlrutils package to publish an R function as a stored procedure. There are several steps to the process, but ultimately it boils down to calling registerStoredProcedure on your R function (and providing the necessary credentials).
If you don't have a connection (or the credentials) to publish to the database yourself, Niels also explains how to use the StoredProcedure function to generate a SQL Server source file defining a stored procedure including your R function, which you can provide to a DBA to deploy.
You can find the complete tutorial, including detailed explanations of the various parameters, at the link below.
Niels Berglund: Creating R Stored Procedures in SQL Server 2016 Using sqlrutils
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.