3.5.2 Verify OML4Py Client Installation for On-Premises Databases

Verify the installation of the OML4Py client components for an on-premises Oracle database.

  1. In your local Python session, connect to the OML4Py server and invoke the same function by name. In the following example, replace the values for the parameters with those for your database.
    import oml
    oml.connect(user='oml_user', password='oml_user_password', host='myhost', 
                port=1521, sid='mysid')
  2. Create a user-defined Python function and store it in the OML4Py script repository.
    oml.script.create("TEST", func='def func():return 1 + 1', overwrite=True)
  3. Call the user-defined function, using the oml.do_eval function.
    res = oml.do_eval(func='TEST')
    res
    2
  4. When you are finished testing, you can drop the test.
    oml.script.drop("TEST")