Run a Sample Workload in JupyterLab

This product is in preview and is subject to change. To get early access to Regulus, sign up on the Regulus Home page.

Overview

This document walks you through a simple workflow where you can use JupyterLab to:

  • Deploy on-demand, scalable compute

  • Connect to your external data source

  • Run the workload

  • Suspend the compute

Before you begin

Run your first workload

Run %help or %help <command> for details on any magic command. See Regulus JupyterLab Magic Command Reference for more details.

  1. Connect to JupyterLab using the URL: http://localhost:8888 and enter the token when prompted.

  2. Connect to Workspaces using the API Key.

    %workspaces_config host=<ip_or_hostname>, apikey=<API_Key>, withtls=F
  3. Create a new project.

    Currently, Regulus supports only AWS.
    %project_create project=<Project_Name>, env=aws
  4. [Optional] Create an authorization object to store the CSP credentials.

    Replace AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_REGION with your values.

    %project_auth_create name=<Auth_Name>, project=<Project_Name>, key=<AWS_ACCESS_KEY_ID>, secret=<AWS_SECRET_ACCESS_KEy>, region=<AWS_REGION>
  5. Deploy a query engine for the project.

    Replace the <Project_Name> to a name of your choice. The size parameter value can be small, medium, large, or extralarge. The default size is small.

    %project_engine_deploy name=<Project_Name>, size=<Size_of_Engine>

    The deployment process will take a few minutes to complete. On successful deployment, a password is generated.

  6. Establish a connection to your project.

    %connect <Project_Name>

    When a connection is established, the interface prompts you for a password. Enter the password generated in the previous step.

  7. Run the sample workload.

    Make sure that you do not have tables named SalesCenter or SalesDemo in the selected database.
    1. Create a table to store the sales center data.

      First, drop the table if it already exists. The command fails if the table does not exist.

      DROP TABLE SalesCenter;
      CREATE MULTISET TABLE SalesCenter ,NO FALLBACK ,
           NO BEFORE JOURNAL,
           NO AFTER JOURNAL,
           CHECKSUM = DEFAULT,
           DEFAULT MERGEBLOCKRATIO
           (
            Sales_Center_id INTEGER NOT NULL,
            Sales_Center_Name VARCHAR(255) CHARACTER SET LATIN NOT CASESPECIFIC)
      NO PRIMARY INDEX ;
    2. Load data into the SalesCenter table using the %dataload magic command.

      %dataload DATABASE=<Project_Name>, TABLE=SalesCenter, FILEPATH=notebooks/sql/data/salescenter.csv
      Unable to locate the salescenter.csv file? Download the file from GitHub Demo: Charting and Visualization Data

      Verify that the data was inserted.

      SELECT * FROM SalesCenter ORDER BY 1
    3. Create a table with the sales demo data.

      DROP TABLE SalesDemo;
      CREATE MULTISET TABLE SalesDemo ,NO FALLBACK ,
           NO BEFORE JOURNAL,
           NO AFTER JOURNAL,
           CHECKSUM = DEFAULT,
           DEFAULT MERGEBLOCKRATIO
           (
            Sales_Center_ID INTEGER NOT NULL,
            UNITS DECIMAL(15,4),
            SALES DECIMAL(15,2),
            COST DECIMAL(15,2))
      NO PRIMARY INDEX ;
    4. Load data into the SalesDemo table using the %dataload magic command.

      %dataload DATABASE=<Project_Name>, TABLE=SalesDemo, FILEPATH=notebooks/sql/data/salesdemo.csv
      Unable to locate the salesdemo.csv file? Download the file from GitHub Demo: Charting and Visualization Data

      Verify that the sales demo data was inserted successfully.

      SELECT * FROM SalesDemo ORDER BY sales

      Open the Navigator for your connection and verify that the tables were created. Run a row count on the tables to verify that the data was loaded.

    5. Use charting magic to visualize the result.

      Provide X and Y axes for your chart.

      %chart sales_center_name, sales, title=Sales Data
    6. Drop the tables.

      DROP TABLE SalesCenter;
      DROP TABLE SalesDemo;
  8. Back up your project metadata and object definitions in your GitHub repository.

    %project_backup project=<Project_Name>
  9. Suspend the query engine.

    %project_engine_suspend project=<Project_Name>

Congrats! You’ve successfully run your first use case in JupyterLab.

Next steps

If you have any questions or need further assistance, please visit our community forum where you can get support and interact with other community members.
Did this page help?