LOADPYTHON

2026-03-06 07:02:42  Updated

The DBMS_PYTHON.LOADPYTHON procedure creates a Python external resource.

Note

This system package is available starting from OceanBase Database V4.4.1.

Syntax

DBMS_PYTHON.LOADPYTHON(IN py_name VARCHAR(65535), IN content LONGBLOB, IN comment VARCHAR(65535) DEFAULT '');

Parameters

Parameter Description
python_name The name of the external resource. You can query the DBA_OB_EXTERNAL_RESOURCES or CDB_OB_EXTERNAL_RESOURCES view for this parameter.
content The binary content of the Python package.
comment Optional. The comment. You can query the DBA_OB_EXTERNAL_RESOURCES or CDB_OB_EXTERNAL_RESOURCES view for this parameter.

Examples

Use the DBMS_PYTHON.LOADPYTHON procedure to load a Python package.

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();

Contact Us