DBMS_PYTHON.LOADPYTHON is used to create Python external resources.
Syntax
DBMS_PYTHON.LOADPYTHON(IN py_name VARCHAR(65535), IN content LONGBLOB, IN comment VARCHAR(65535) DEFAULT '');
Parameters
Parameter |
Note |
|---|---|
| python_name | The corresponding external resource name. You can obtain it from the DBA_OB_EXTERNAL_RESOURCES or CDB_OB_EXTERNAL_RESOURCES Query in the view. |
| content | The binary content of the Python package. |
| comment | Optional. Indicates a comment. You can also add DBA_OB_EXTERNAL_RESOURCES or CDB_OB_EXTERNAL_RESOURCES Query in the view. |
Examples
Use the DBMS_PYTHON.LOADPYTHON procedure to load Python packages.
String url = "<URL to Python>";
InputStream is = new URL(url).openStream();
// conn is a connection to OceanBase
PreparedStatement ps = conn.prepareStatement("call dbms_python.loadpython(? ,? ,? )");
ps.setString(1, "my_add_python");
ps.setBlob(2, is);
ps.setString(3, "my add UDF python");
ps.execute();