10.5.1 About the SQL API for Embedded Python Execution with On-Premises Database

With the SQL API, you can run user-defined Python functions in one or more separate Python engines in an Oracle database environment, manage user-defined Python functions in the OML4Py script repository, and control access to and get information about datastores and about user-defined Python functions in the script repository.

You can use the SQL interface for Embedded Python Execution with an on-premises Oracle Database instance.

OML4Py provides the following types of SQL functions and procedures.

  • SQL table functions for running user-defined Python functions in one or more database-spawned and managed Python engines; the user-defined Python functions may reference Python objects in OML4Py datastores and use third-party packages installed with the database server machine Python engines..

  • PL/SQL procedures for creating and dropping user-defined Python functions in the OML4Py script repository.

  • PL/SQL procedures for granting and revoking the read privilege to datastores and the datastore objects in them, and to user-defined Python functions in the OML4Py script repository.

The following table lists the SQL functions for Embedded Python Execution and the PL/SQL procedures for managing datastores and user-defined Python functions.

Function or Procedure Description
pyqEval function

Runs a user-defined Python function on the data passed in.

pyqGroupEval function

Groups data by one or more columns and runs a user-defined Python function on each group.

pyqTableEval function

Runs a user-defined Python function on data in the database.

pyqRowEval function

Runs the specified number of rows in each invocation of the user-defined Python function in parallel processes.

pyqGrant procedure

Grants the read privilege to another user to a user-defined Python function owned by the current user.

pyqRevoke procedure

Revokes the read privilege that was granted to another user to a user-defined Python function owned by the current user.

pyqScriptCreate procedure

Creates a user-defined Python function in the script repository.

pyqScriptDrop procedure

Drops a user-defined Python function from the script repository.