You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/py-udf.md
+71-15Lines changed: 71 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -171,7 +171,52 @@ $$;
171
171
```
172
172
173
173
## Manage Python Libraries {#python_libs}
174
-
By default, Timeplus Enterprise ships a clean Python 3.10 environment, plus the following essential libraries:
174
+
175
+
Starting from Proton/Timeplus Enterprise 3.0, manage Python UDF packages directly via SQL `SYSTEM` commands. This is the only supported flow on 3.0+. The 2.x methods below are not supported on 3.0.
176
+
177
+
### Install/List/Uninstall via SQL (3.0+) {#install_sql}
178
+
Examples:
179
+
```sql
180
+
-- Install latest
181
+
SYSTEM INSTALL PYTHON PACKAGE 'requests';
182
+
183
+
-- Install with version specifier (PEP 440)
184
+
SYSTEM INSTALL PYTHON PACKAGE 'requests>2.0';
185
+
SYSTEM INSTALL PYTHON PACKAGE 'requests==2.32.3';
186
+
187
+
-- Alternative form with separate version literal
188
+
SYSTEM INSTALL PYTHON PACKAGE 'requests''2.32.3';
189
+
190
+
-- List installed packages
191
+
SYSTEM LIST PYTHON PACKAGES;
192
+
193
+
-- Uninstall
194
+
SYSTEM UNINSTALL PYTHON PACKAGE 'requests';
195
+
```
196
+
197
+
Notes:
198
+
- Applies to Proton/Enterprise 3.0+ with Python UDF enabled (Python 3.10).
-`SYSTEM LIST PYTHON PACKAGES` returns columns `package_name`, `version`.
201
+
- Install/uninstall runs asynchronously. Check status via `system.python_package_tasks`:
202
+
```sql
203
+
SELECT status, error_code, error_message
204
+
FROMsystem.python_package_tasks
205
+
WHERE package_name='requests'AND operation='install'
206
+
ORDER BY created_at DESCLIMIT1;
207
+
```
208
+
209
+
Permissions:
210
+
- Built-in users in official Docker images (e.g., `default`, `proton`) typically have this privilege.
211
+
- For a new user, grant it explicitly:
212
+
```sql
213
+
GRANT SYSTEM RELOAD CONFIG ON*.* TO gen;
214
+
```
215
+
216
+
See more: /sql-system-python-packages
217
+
218
+
### Built-in Libraries
219
+
By default, Timeplus ships a clean Python 3.10 environment, plus the following essential libraries:
175
220
176
221
```json
177
222
[
@@ -233,11 +278,15 @@ Follow the guide below to install extra Python libraries. The following librarie
233
278
234
279
Some Python libraries may require additional dependencies or OS specific packages. Contact us if you need help.
235
280
236
-
### Install Python Libraries {#install_lib}
237
-
To install new Python libraries, you can either call the REST API of timeplusd in Timeplus Enterprise v2.7, or use the new `timeplusd python pip install` command-line tool introduced in Timeplus Enterprise v2.8.
For Enterprise 2.x, you can either call the REST API (2.7+) or use `timeplusd python -m pip` (2.8+).
283
+
284
+
Important: These legacy methods are not supported on Proton/Enterprise 3.0. Use the SQL `SYSTEM` commands instead.
285
+
286
+
#### Install via `timeplusd python pip` (2.8) {#install_pip}
287
+
Only for Enterprise v2.8. Not available on 3.0+.
238
288
239
-
#### Install via `timeplusd python pip` {#install_pip}
240
-
Starting from Timeplus Enterprise v2.8, you can use the `timeplusd python pip install` command-line tool to install Python libraries. For example, to install the `numpy` library, you can use the following command:
289
+
In Enterprise v2.8, you can use the `timeplusd python -m pip` command-line tool to install Python libraries. For example, to install the `numpy` library:
You can also call the REST API of timeplusd in Timeplus Enterprise v2.7 or above.
301
+
Only for Enterprise v2.7–v2.8. Not available on 3.0+.
302
+
303
+
You can call the REST API of timeplusd in Timeplus Enterprise v2.7+.
253
304
254
305
:::info
255
306
To access the REST API, you need to create an administrator account and set the HTTP headers `x-timeplus-user` and `x-timeplus-key` with the user and password, such as `curl -H "x-timeplus-user: theUser" -H "x-timeplus-key:thePwd" ..`.
@@ -265,24 +316,29 @@ If you need to install a specific version of a library, you can specify it in th
- Versioning: Accepts PEP 440 specifiers in the first literal (e.g., `>=`, `==`, `~=`). When using the second literal, provide the exact version string.
28
+
- Install location: Uses pip’s user install under the embedded interpreter; no system-level Python changes.
29
+
- Async operations: Install/uninstall run asynchronously. Track progress via `system.python_package_tasks`.
30
+
31
+
Monitor status
32
+
```sql
33
+
SELECT status, error_code, error_message
34
+
FROMsystem.python_package_tasks
35
+
WHERE package_name ='requests'AND operation ='install'
36
+
ORDER BY created_at DESC
37
+
LIMIT1;
38
+
```
39
+
40
+
List installed packages
41
+
```sql
42
+
SYSTEM LIST PYTHON PACKAGES; -- columns: package_name, version
43
+
```
44
+
45
+
Granting permissions
46
+
```sql
47
+
-- Built-in users in official images (e.g., default, proton) typically have it already.
48
+
GRANT SYSTEM RELOAD CONFIG ON*.* TO gen;
49
+
```
50
+
51
+
## Compatibility
52
+
- Proton/Enterprise 3.0+: Use these SQL commands. This is the only supported method in 3.0+.
53
+
- Enterprise 2.x: Use REST API or `timeplusd python -m pip` (see /py-udf#install_lib). These legacy methods are not supported on 3.0+.
0 commit comments