3.4.4 Grant Users the Required Privileges for On-Premises Database

Instructions for granting the privileges required for using OML4Py with an on-premises database.

To use OML4Py (OML4Py), a user must have certain database privileges. To store and manage user-defined Python functions in the OML4Py script repository, a user must also have the PYQADMIN database role.

User Privileges

After installing the OML4Py server on an on-premises Oracle database server, grant the following privileges to any OML4Py user.

  • CREATE SESSION
  • CREATE TABLE
  • CREATE VIEW
  • CREATE PROCEDURE
  • CREATE MINING MODEL
  • EXECUTE ON CTXSYS.CTX_DDL ( required for using Oracle Text Processing capability in the algorithm classes in the oml.algo package )

To grant all of these privileges, on the on-premises Oracle database server start SQL as a database administrator and run the following SQL statement, where oml_user is the OML4Py user:

GRANT CREATE SESSION, CREATE TABLE, CREATE VIEW, CREATE PROCEDURE, 
CREATE MINING MODEL, EXECUTE ON CTXSYS.CTX_DDL to oml_user;

Script Repository and Datastore Management

The OML4Py script repository stores user-defined Python functions that a user can invoke in an Embedded Python Execution function. An OML4Py datastore stores Python objects that can be used in subsequent Python sessions. A user-defined Python function in the script repository or a datastore can be available to any user or can be restricted for use by the owner only or by those granted access to it.

The OML4Py server installation script creates the PYQADMIN role in the database. A user must have that role to do the following:

  • Store user-defined Python functions in the script repository.
  • Drop user-defined Python function from the repository
  • Grant or revoke permission to use a user-defined Python function in the script repository.
  • Grant or revoke permission to use the objects in a datastore.

To grant this role to a user, on the on-premises Oracle database server start SQL as a database administrator and run the following SQL statement, where oml_user is your OML4Py user:

GRANT PYQADMIN to oml_user;