Change Interpreter Bindings for Specific Paragraphs in a Notebook

The interpreter binding order that is set for a notebook applies to all the paragraphs in that notebook. However, you can override the interpreter binding for SQL and PL/SQL interpreters for any specific paragraph in the notebook.

Note:

Do not override Python paragraph interpreter bindings as they will not share the same Python engine backend.
To change the interpreter binding for a specific paragraph in a notebook:
  1. Open the notebook and click the gear icon to view the interpreter bindings and its order.
    Notebook editor options
    In this example, all the three SQL interpreters are bound to the notebook, and the interpreter with low resource allocation adwpcwdp_low %sql is the default, as it is the first interpreter on the list. The MarkDown interpreter is not bound to the notebook

    Note:

    The names of the interpreters are in the format databasename_low, databasename_medium and databasename_high which is the same as the interpreter binding order name.
    In this example, the interpreter names are:
    • adwp_low % sql(default),%script, %python
    • adwp_medium % sql(default),%script, %python
    • adwp_high % sql(default), %script,%python.
    • md %md(default)
    Default interpreter binding order
    The first Python interpreter in the list is used to run all Python paragraphs in the notebook. For example, if the low binding is selected, then all Python paragraphs are run using the low binding Python interpreter. All the other paragraphs with SQL and Script interpreter bindings are run using the low database name service, that is, adwp_low. If any Python scripts run queries against the database, then those queries are run using the low database name service, that is, adwp_low in this example.
  2. To change the interpreter bindings order for a particular paragraph in the notebook:
    • Scroll down to the paragraph for which you want to change the interpreter
    • Call the interpreter with the specific binding
    • Run the paragraph
    For example, call the interpreter with medium resource allocation by typing %adwp_medium for the first paragraph in the notebook, and run the paragraph. In this example, adwp is the database name.
    Modified interpreter binding order
    Notice that the first paragraph runs without any error after changing the interpreter binding. The second paragraph in this notebook has the default binding.
  3. Validate the interpreter binding for first paragraph of this notebook by typing the SQL statement SELECT SYS_CONTEXT ('USERENV', 'SERVICE_NAME') FROM DUAL;
    The SQL statement returns the following information about the interpreter with medium binding:
    LGKFDTOOBOQK48I_CWDP_medium.adwc.oraclecloud.com
    Validate interpreter binding of a paragraph after change
    In this example, with reference to the screenshot:
    • LGKFDTOOBOQK48I is the tenant name
    • CWDP is the database name
    • medium is the service name
    • adwc.oraclecloud.com is the domain

    Note:

    For the rest of the paragraphs in this notebook, the interpreter binding is the default. You may validate the bindings for each paragraph by running step 3.
    This completes the task of changing the interpreter binding for a particular paragraph in the notebook. The rest of the paragraphs in the notebook have the default binding for the interpreter.