Cloudera Tutorials

Optimize your time with detailed tutorials that clearly explain the best way to deploy, use, and manage Cloudera products. Login or register below to access all Cloudera tutorials.

ClouderaNOW24     See the latest Cloudera Innovations

Watch now




See for yourself how easy it is to create a simple inventory management web application using Cloudera Operational Database (COD) and Cloudera Machine Learning (CML) on Cloudera Data Platform (CDP).





  • Have access to Cloudera Data Platform (CDP) Public Cloud
  • Have created a CDP workload User
  • Ensure proper CML role access
    • MLUser: ability to run workloads
    • MLAdmin: ability to create and delete workspaces



Watch Video


The video below provides a brief overview of what is covered in this tutorial:



Download Assets


There are two (2) options in getting assets for this tutorial:

  1. Download a ZIP file

It contains only necessary files used in this tutorial. Remember its location. No need to unzip the file.

  1. Clone our GitHub repository

It provides assets used in this and other tutorials; organized by tutorial title.



Setup Operational Database


If your environment doesn’t already have a database created, let’s create one.

Select Operational Database from Cloudera Data Platform (CDP) home page:




Two simple pieces of information are needed to create a database - the Environment name and Database name. For example:

  1. Environment: <your environment name>
  2. Database Name: sample-opdb
  3. Select Create Database




Get Database Connection URL


  1. Open your database by selecting its name, sample-opdb.
  2. Select Phoenix Python tab
  3. Copy the Phoenix Python URL
  4. Later in the tutorial, we will use this URL to configure our web application to connect to this database.




Setup Machine Learning


Provision ML Workspace


If your environment doesn’t already have a Machine Learning Workspace provisioned, let’s provision it.

Select Machine Learning from Cloudera Data Platform (CDP) home page:




In the ML Workspaces section, select Provision Workspace.

Two simple pieces of information are needed to provision an ML workspace - the Workspace name and the Environment name. For example:

  1. Workspace Name: cml-tutorial
  2. Environment: <your environment name>
  3. Select Provision Workspace




Create Project


Beginning from the ML Workspaces section, open your workspace by selecting its name, cml-tutorial.

Select New Project

Complete the New Project form using:

  1. Project Name: opdb-web-application
  2. Project Description:
    Simple inventory management system using Cloudera Operational Database (COD)
  1. Initial Setup: Local Files
    Upload or Drag-Drop tutorial-files.zip you downloaded earlier
  2. Select Create Project




Application Configuration


Beginning from the Projects section, select the project name, opdb-web-application.

Select New Session and complete the session form:

  1. Session Name: configuration
  2. Editor: Workbench
  3. Kernel: Python 3
  4. Edition: Standard
  5. Resource Profile: 1 vCPU / 2 GiB Memory
  6. Select Start Session




Let’s make a minor configuration change and install the dependencies:

  1. Modify the configuration file, config.ini.template, with the Phoenix Python URL we retrieved earlier and username/password.
    Url=<URL from Phoenix Thin JDBC connection>

    Save the file as config.ini: File > Save As > config.ini

  2. Install the dependencies by issuing the following statement in the command-line:
  3. !pip3 install -r requirements.txt




In the same session (or a new one), let’s create and populate a table that we’ll be using in our application.

Select file db_setup.py and click on




Create and Run Web Application


Let’s create our inventory management system web application.

Beginning from the Applications section, select New Application and fill out the form as follows:

  1. Name: opdb-web-app
  2. Subdomain: opdb-web-app
  3. Description: Simple inventory management system
  4. Script: main.py
  5. Kernel: Python 3
  6. Select Create Application




After a few moments, the application is up and running. Select the application’s name, opdb-web-app, to open the web application.




This web application accepts a part number and quantity. It first verifies that the part exists, if it does, it will decrease/increase the quantity on hand. For example:

A positive quantity value, decreases the quantity on hand.

A negative quantity value, increases the quantity on hand.






Congratulations on completing the tutorial.

While this was a simple example of a web application, I hope it sparks your imagination and inspires other creative solutions.



Further Reading







Your form submission has failed.

This may have been caused by one of the following:

  • Your request timed out
  • A plugin/browser extension blocked the submission. If you have an ad blocking plugin please disable it and close this message to reload the page.