ATP, APEX and Jupyter

Suppose you have setup the ATP connection, and you are getting ready to learn more about creating APEX applications

If you remember from one of our previous tutorials, Setup APEX on ATP, we were given three choices of creating an application:

For this tutorial, we will build a small example on how to create an application by adding pages to existing data ("New Application").

However, let's suppose we do not have the data on our side. That would imply we need to create a tablespace and populate it.

One approach to implement this would be by connecting to ATP using Jupyter, and then creating and populating a tablespace with the help of python dataframes; once the tablespace is created, we can add it to our application.

Prepare environment

1) Install Jupyter (Ubuntu version, because this environment is deployed on my WSL)

apt install jupyter-notebook

2) Start Jupyter (in my case, I am root) and make sure you have the required packages installed:

root@isaacEXE:/home/ora# jupyter-notebook --allow-root
[W 2021-01-17 21:16:48.015 LabApp] 'allow_root' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2021-01-17 21:16:48.016 LabApp] 'allow_root' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[...]
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=c0f8eb5b3c8ba697ae6db1c0f8eb5b4c7ae6db1c0f8eb5
     or http://127.0.0.1:8888/?token=c0f8eb5bc8ba697ae6db1c0f8eb5b4c7ae6db1c0f8eb5
[...]

Add one of those links into your browser, got to File>New File>Python3, and make sure you install the required packages, if not present:

3) Download the data set we will be using to create the tablespace, iris.csv:

root@isaacEXE:/home/ora#  wget https://gist.githubusercontent.com/netj/8836201/raw/6f9306ad21398ea43cba4f7d537619d0e07d5ae3/iris.csv
root@isaacEXE:/home/ora# ls iris*
iris.csv

4) Import the python modules you have just checked:

5) Make sure you TNS_ADMIN environment is setup, if not, recheck About tnsname.ora As a reminder, our TNS_ADMIN was setup under /home/oracky/wallet.

Next, start your sqlalchemy application by creating the engine. Provide the oracle APEX user - the user you have used for creating workspace, the password and the database along with its priority.

6) Import the dataset iris.csv into your ATP, by using the python dataframes:

7) Create the new tablespace in ATP:

8) Check in SQL Developer is tablespace DATAJUPYTER is created. It should appear for user ZACK:

Create application in APEX

Now you are ready to go back to your APEX workspace.

1) After you select "New Application", you will be brought to a blueprint for creating an application: provide a name, and select "Add Page":

2) Select "Chart"

... and then, provide the name of the tablespace created with Jupyter and two columns columns, along with a desired representation of the dashboard:

2) Provide a page name, in this example "datajupyterpage", and click on "Add Page". You will be brought back to your "Create an Application" page, only this time, the page that contains the data from the tablespace is shown:

3) Proceed by selecting "Check All" from Features, and click "Create Application" to start the creation.

4) As soon as your application is created, you should notice a page as below. Proceed with "Run Application"

5) Provide APEX credentials:

6) You are now ready to access the page you have set-up earlier:

7) Click on it, and it will take you straight to the dashboard representation:

[ ... still in progress ...]

Last updated