Skip to main content

Run Teradata Jupyter Notebook Demos for VantageCloud Lake in Visual Studio Code

Overview

Visual Studio Code is a popular open-source code editor compatible with Windows, MacOs, and Linux. Developers use this Integrated Development Environment (IDE) for coding, debugging, building, and deploying applications. In this quickstart guide, we launch VantageCloud Lake Jupyter notebook demos within Visual Studio Code.

vscode.png

Prerequisites

Before you begin, ensure you have the following prerequisites in place:

Clone VantageCloud Lake Demo repository

Begin by cloning the GitHub repository and navigating to the project directory:

Start a Jupyterlab docker container with Teradata Jupyter Exensions

To launch Teradata VantageCloud Lake demos, we need the Teradata Jupyter Extensions for Docker. These extensions provide the SQL ipython kernel, utilities to manage connections to Teradata, and the database object explorer to make you productive while interacting with the Teradata database.

Next, start a container and bind it to the existing lake-demos directory. Choose the appropriate command based on your operating system:

Note

For Windows, run the docker command in PowerShell.

Take note of the resulting URL and token; you’ll need them to establish the connection from Visual Studio Code. terminal.png

Visual Studio Code Configuration

Open lake-demos project directory in Visual Studio Code. The repository contains the following project tree:

LAKE_DEMOS

Edit vars.json file

Edit the vars.json file to include the required credentials to run the demos

VariableValue
"host"Public IP value from your VantageCloud Lake environment
"UES_URI"Open Analytics from your VantageCloud Lake environment
"dbc"The master password of your VantageCloud Lake environment.

To retrieve a Public IP address and Open Analytics Endpoint follow these instructions

info

Change passwords in the vars.json file. You'll see that in the sample vars.json, the passwords of all users are defaulted to "password", this is just for matters of the sample file, you should change all of these password fields to strong passwords, secure them as necessary and follow other password management best practices.

Modify path to vars.json in UseCases directory

In the UseCases directory, all .ipynb files use the path ../../vars.json to load the variables from the JSON file when working from Jupyterlab. To work directly from Visual Studio Code, update the code in each .ipynb to point to vars.json.

The quickest way to make these changes is via search feature on the left vertical menu. Search for

and replace with:

search

replace

Configuring Jupyter Kernels

Open 0_Demo_Environment_Setup.ipynb and click on Select Kernel at the top right corner of Visual Studio Code.

If you have not installed Jupyter and Python extensions, Visual Studio Code will prompt you to install them. These extensions are necessary for Visual Studio Code to detect Kernels. To install them, select 'Install/Enable suggested extensions for Python and Jupyter.'

select.kernel.png

Once you've installed the necessary extensions, you'll find options in the drop-down menu. Choose Existing Jupyter Kernel.

existing.kernel.png

Enter the URL of the running Jupyter Server and press enter.

server.url.png

Enter the token found in your terminal when mounting files to the Docker container and press Enter.

server.password.png

Change Server Display Name (Leave Blank To Use URL)

server.display.name.png

You now have access to all the Teradata Vantage extension kernels. Select Python 3 (ipykernel) from the running Jupyter server.

python.kernel.png

Run demos

Execute all the cells in 0_Demo_Environment_Setup.ipynb to setup your environment. Followed by 1_Demo_Setup_Base_Data.ipynb to load the base data required for demo. To learn more about the demo notebooks, go to Teradata Lake demos page on GitHub.

demoenvsetup.png

Summary

In this quickstart guide, we configured Visual Studio Code to access VantageCloud Lake demos using Jupyter notebooks.

Also of interest