Skip to content

Commit 49e4ea2

Browse files
committed
SQLML: sqlmlutils is per db/user
1 parent 1fcbc9c commit 49e4ea2

5 files changed

Lines changed: 20 additions & 9 deletions

docs/machine-learning/package-management/install-additional-python-packages-on-sql-server.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Install Python packages with sqlmlutils
33
description: Learn how to use Python pip to install new Python packages on an instance of SQL Server Machine Learning Services.
44
ms.prod: sql
55
ms.technology: machine-learning
6-
ms.date: 06/29/2020
6+
ms.date: 08/26/2020
77
ms.topic: how-to
88
author: garyericson
99
ms.author: garye
@@ -18,6 +18,7 @@ monikerRange: ">=sql-server-ver15||>=sql-server-linux-ver15||=azuresqldb-mi-curr
1818
::: moniker range=">=sql-server-ver15||>=sql-server-linux-ver15||=sqlallproducts-allversions"
1919
This article describes how to use functions in the [**sqlmlutils**](https://github.com/Microsoft/sqlmlutils) package to install new Python packages to an instance of [Machine Learning Services on SQL Server](../sql-server-machine-learning-services.md) and on [Big Data Clusters](../../big-data-cluster/machine-learning-services.md). The packages you install can be used in Python scripts running in-database using the [sp_execute_external_script](https://docs.microsoft.com/sql/relational-databases/system-stored-procedures/sp-execute-external-script-transact-sql) T-SQL statement.
2020
::: moniker-end
21+
2122
::: moniker range="=azuresqldb-mi-current||=sqlallproducts-allversions"
2223
This article describes how to use functions in the [**sqlmlutils**](https://github.com/Microsoft/sqlmlutils) package to install new Python packages to an instance of [Azure SQL Managed Instance Machine Learning Services](/azure/azure-sql/managed-instance/machine-learning-services-overview). The packages you install can be used in Python scripts running in-database using the [sp_execute_external_script](https://docs.microsoft.com/sql/relational-databases/system-stored-procedures/sp-execute-external-script-transact-sql) T-SQL statement.
2324
::: moniker-end
@@ -43,9 +44,9 @@ For more information about package location and installation paths, see [Get Pyt
4344

4445
+ Packages must be compliant with the version of Python you have, and the version of Python on the server must match the version of Python on the client computer. For information on which version of Python is included with each SQL Server version, see the [Python and R versions](../sql-server-machine-learning-services.md#versions). To confirm the version of Python in a particular SQL instance, see [View the version of Python](python-package-information.md#bkmk_SQLPythonVersion).
4546

46-
+ The Python package library is located in the Program Files folder of your SQL Server instance and, by default, installing in this folder requires administrator permissions. For more information, see [Package library location](../package-management/python-package-information.md#default-python-library-location).
47+
+ Package installation is specific to the SQL instance, database, and user you specify in the connection information you provide to **sqlmlutils**. To use the package in multiple SQL instances or databases, or for different users, you'll need to install the package for each one. The exception is that if the package is installed using the database administrator account, then the package is available to all users in that database.
4748

48-
+ Package installation is per instance. If you have multiple instances of Machine Learning Services, you must add the package to each one.
49+
+ The Python package library is located in the Program Files folder of your SQL Server instance and, by default, installing in this folder requires administrator permissions. For more information, see [Package library location](../package-management/python-package-information.md#default-python-library-location).
4950

5051
+ Before adding a package, consider whether the package is a good fit for the SQL Server environment.
5152

@@ -93,7 +94,7 @@ You can also install **sqlmlutils** from a zip file:
9394

9495
## Add a Python package on SQL Server
9596

96-
Using **sqlmlutils**, you can add Python packages to a SQL instance. You can then use those packages in your Python code running in the SQL instance.
97+
Using **sqlmlutils**, you can add a Python package to a SQL instance. You can then use those packages in your Python code running in the SQL instance. **sqlmlutils** uses [CREATE EXTERNAL LIBRARY](../../t-sql/statements/create-external-library-transact-sql.md) to install the package and each of its dependencies.
9798

9899
In the following example, you'll add the [text-tools](https://pypi.org/project/text-tools/) package to SQL Server.
99100

docs/machine-learning/package-management/install-additional-r-packages-on-sql-server.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ This article describes how to use functions in the [**sqlmlutils**](https://gith
3434

3535
### Other considerations
3636

37+
- Package installation is specific to the SQL instance, database, and user you specify in the connection information you provide to **sqlmlutils**. To use the package in multiple SQL instances or databases, or for different users, you'll need to install the package for each one. The exception is that if the package is installed using the database administrator account, then the package is available to all users in that database.
38+
3739
- R script running in SQL Server can use only packages installed in the default instance library. SQL Server cannot load packages from external libraries, even if that library is on the same computer. This includes R libraries installed with other Microsoft products.
3840

3941
- On a hardened SQL Server environment, you might want to avoid the following:

docs/t-sql/statements/alter-external-library-transact-sql.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description: "ALTER EXTERNAL LIBRARY (Transact-SQL)"
33
title: "ALTER EXTERNAL LIBRARY (Transact-SQL) | Microsoft Docs"
44
ms.custom: ""
5-
ms.date: 06/10/2020
5+
ms.date: 08/26/2020
66
ms.prod: sql
77
ms.reviewer: ""
88
ms.technology: machine-learning
@@ -141,7 +141,7 @@ WITH ( LANGUAGE = <language> )
141141

142142
**library_name**
143143

144-
Specifies the name of an existing package library. Libraries are scoped to the user. Library names are must be unique within the context of a specific user or owner.
144+
Specifies the name of an existing package library. Libraries are scoped to the user. Library names must be unique within the context of a specific user or owner.
145145

146146
The library name cannot be arbitrarily assigned. That is, you must use the name that the calling runtime expects when it loads the package.
147147

@@ -215,6 +215,8 @@ For the Python language, the package in a .whl or .zip file must be prepared in
215215

216216
The `ALTER EXTERNAL LIBRARY` statement only uploads the library bits to the database. The modified library is installed when a user runs code in [sp_execute_external_script (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-execute-external-script-transact-sql.md) that calls the library.
217217

218+
A number of packages, referred to as *system packages*, are pre-installed in a SQL instance. System packages cannot be added, updated, or removed by the user.
219+
218220
## Permissions
219221

220222
By default, the **dbo** user or any member of the role **db_owner** has permission to run ALTER EXTERNAL LIBRARY. Additionally, the user who created the external library can alter that external library.

docs/t-sql/statements/create-external-library-transact-sql.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description: "CREATE EXTERNAL LIBRARY (Transact-SQL) - SQL Server"
33
title: "CREATE EXTERNAL LIBRARY (Transact-SQL) - SQL Server | Microsoft Docs"
44
ms.custom: ""
5-
ms.date: 06/10/2020
5+
ms.date: 08/26/2020
66
ms.prod: sql
77
ms.reviewer: ""
88
ms.technology: machine-learning
@@ -142,7 +142,9 @@ WITH ( LANGUAGE = <language> )
142142

143143
**library_name**
144144

145-
Libraries are added to the database scoped to the user. Library names must be unique within the context of a specific user or owner. For example, two users **RUser1** and **RUser2** can both individually and separately upload the R library `ggplot2`. However, if **RUser1** wanted to upload a newer version of `ggplot2`, the second instance must be named differently or must replace the existing library.
145+
Libraries uploaded to the instance can be either public or private. If the library is created by a member of `dbo`, the library is public and can be shared with all users. Otherwise, the library is private to that user only.
146+
147+
Library names must be unique within the context of a specific user or owner. For example, two users **RUser1** and **RUser2** can both individually and separately upload the R library `ggplot2`. However, if **RUser1** wanted to upload a newer version of `ggplot2`, the second instance must be named differently or must replace the existing library.
146148

147149
Library names cannot be arbitrarily assigned; the library name should be the same as the name required to load the library in the external script.
148150

@@ -223,6 +225,8 @@ The `CREATE EXTERNAL LIBRARY` statement uploads the library bits to the database
223225

224226
Libraries uploaded to the instance can be either public or private. If the library is created by a member of `dbo`, the library is public and can be shared with all users. Otherwise, the library is private to that user only.
225227

228+
A number of packages, referred to as *system packages*, are pre-installed in a SQL instance. System packages cannot be added, updated, or removed by the user.
229+
226230
## Permissions
227231

228232
Requires the `CREATE EXTERNAL LIBRARY` permission. By default, any user who has **dbo** who is a member of the **db_owner** role has permissions to create an external library. For all other users, you must explicitly give them permission using a [GRANT](https://docs.microsoft.com/sql/t-sql/statements/grant-database-permissions-transact-sql) statement, specifying CREATE EXTERNAL LIBRARY as the privilege.

docs/t-sql/statements/drop-external-library-transact-sql.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description: "DROP EXTERNAL LIBRARY (Transact-SQL)"
33
title: "DROP EXTERNAL LIBRARY (Transact-SQL) | Microsoft Docs"
44
ms.custom: ""
5-
ms.date: 06/10/2020
5+
ms.date: 08/26/2020
66
ms.prod: sql
77
ms.reviewer: ""
88
ms.technology: machine-learning
@@ -69,6 +69,8 @@ An informational message is returned if the statement was successful.
6969

7070
Unlike other `DROP` statements in SQL Server, this statement supports specifying an optional authorization clause. This allows **dbo** or users in the **db_owner** role to drop a package library uploaded by a regular user in the database.
7171

72+
A number of packages, referred to as *system packages*, are pre-installed in a SQL instance. System packages cannot be added, updated, or removed by the user.
73+
7274
## Examples
7375

7476
::: moniker range=">=sql-server-2017||>=sql-server-linux-ver15||=sqlallproducts-allversions"

0 commit comments

Comments
 (0)