7.5.3.3 pyqJobResult Function

Use the pyqJobResult function to return the job result.

Syntax

FUNCTION PYQSYS.pyqJobResult(
  job_id       VARCHAR2, 
  out_fmt      VARCHAR2 DEFAULT 'JSON'
)
RETURN SYS.AnyDataSet

Parameters

Parameter Description
job_id

The ID of the asynchronous job.

out_fmt
The format of the job result. It can be one of the following:
  • A JSON string that specifies the column names and data types of the table returned by the function. Any image data is discarded. The Python function must return a pandas.DataFrame, a numpy.ndarray, a tuple, or a list of tuples.
  • The string 'JSON', which specifies that the table returned contains a CLOB that is a JSON string.
  • The string 'XML', which specifies that the table returned contains a CLOB that is an XML string. The XML can contain both structured data and images, with structured or semi-structured Python objects first, followed by the image or images generated by the Python function.
  • The string 'PNG', which specifies that the table returned contains a BLOB that has the image or images generated by the Python function. Images are returned as a base 64 encoding of the PNG representation.

Example

The following example shows a pyqJobResult call and its output.

SQL> select * from pyqJobResult(
    job_id => '<job id>',
    out_fmt => '{"NAME":"varchar2(7)","SCORE":"number","FINALGRADE":"number","DIFF":"number"}'
);
NAME       SCORE      FINALGRADE DIFF
---------- ---------- ---------- ----------
Abbott     90         87          3
Branford   92         97         -5
Crandell   81         71         10
Dennison   85         72         13
Edgar      89         80          9
Faust      78         73          5
Greeley    82         91         -9
Hart       84         80          4
Isley      88         86          2
Jasper     91         83          8

10 rows selected.