Enable or disable remote package management for SQL Server
This article describes how to enable management of R packages from a remote instance of Machine Learning Server. After the package management feature has been enabled, you can use RevoScaleR commands to install packages on a database from a remote client.
Currently management of R libraries is supported; support for Python is on the roadmap.
By default, the external package management feature for SQL Server is disabled, even if machine learning features have been installed. You must run a separate script to enable the feature as described in the next section.
Overview of process and tools
To enable or disable package management, use the command-line utility RegisterRExt.exe, which is included with the RevoScaleR package.
Enabling this feature is a two-step process, requiring a database administrator: you enable package management on the SQL Server instance (once per SQL Server instance), and then enable package management on the SQL database (once per SQL Server database).
Disabling the package management feature also requires multipel steps: you remove database-level packages and permissions (once per database), and then remove the roles from the server (once per instance).
Enable package management
Open an elevated command prompt and navigate to the folder containing the utility, RegisterRExt.exe. The default location is
Run the following command, providing appropriate arguments for your environment:
RegisterRExt.exe /installpkgmgmt [/instance:name] [/user:username] [/password:*|password]
This command creates instance-level objects on the SQL Server computer that are required for package management. It also restarts the Launchpad for the instance.
If you do not specify an instance, the default instance is used. If you do not specify a user, the current security context is used. For example, the following command enables package management on the instance in the path of RegisterRExt.exe, using the credentials of the user who opened the command prompt:
To add package management to a specific database, run the following command from an elevated command prompt:
RegisterRExt.exe /installpkgmgmt /database:databasename [/instance:name] [/user:username] [/password:*|password]
This command creates some database artifacts, including the following database roles that are used for controlling user permissions:
For example, the following command enables package management on the database, on the instance where RegisterRExt is run. If you do not specify a user, the current security context is used.
RegisterRExt.exe /installpkgmgmt /database:TestDB
Repeat the command for each database where packages must be installed.
To verify that the new roles have been successfully created, in SQL Server Management Studio, click the database, expand Security, and expand Database Roles.
You can also run a query on sys.database_principals such as the following:
SELECT pr.principal_id, pr.name, pr.type_desc, pr.authentication_type_desc, pe.state_desc, pe.permission_name, s.name + '.' + o.name AS ObjectName FROM sys.database_principals AS pr JOIN sys.database_permissions AS pe ON pe.grantee_principal_id = pr.principal_id JOIN sys.objects AS o ON pe.major_id = o.object_id JOIN sys.schemas AS s ON o.schema_id = s.schema_id;
After you have enabled this feature, you can use RevoScaleR function to install or uninstall packages from a remote R client.
Disable package management
From an elevated command prompt, run the RegisterRExt utility again, and disable package management at the database level:
RegisterRExt.exe /uninstallpkgmgmt /database:databasename [/instance:name] [/user:username] [/password:*|password]
This command removes database objects related to package management from the specified database. It also removes all the packages that were installed from the secured file system location on the SQL Server computer.
Repeat this command on each database where package management was used.
(Optional) After all databases have been cleared of packages using the preceding step, run the following command from an elevated command prompt:
RegisterRExt.exe /uninstallpkgmgmt [/instance:name] [/user:username] [/password:*|password]
This command removes the package management feature from the instance. You might need to manually restart the Launchpad service once more to see changes.