Important
|
This product is in preview and is subject to change. If you’re interested in learning more about this offering, contact Teradata Support. |
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
-
Deploy and configure Teradata AI Unlimited Workspaces and JupyterLab. See :install-ai-unlimited-workspaces-docker.adoc and :install-ai-unlimited-interface-docker.adoc.
-
Copy and retain the following:
-
CSP environment variables from your Console. See Environment Variables.
-
API Key from workspace service.
-
Run %help
or %help <command>
for details on any magic command. See :ai-unlimited-magic-reference.adoc for more details.
-
Connect to JupyterLab using the URL: http://localhost:8888 and enter the token when prompted.
-
Connect to the workspace service using the API Key.
%workspaces_config host=<ip_or_hostname>, apikey=<API_Key>, withtls=F
-
Create a new project.
NoteCurrently, Teradata AI Unlimited supports AWS and Azure. %project_create project=<Project_Name>, env=<CSP>, team=<Project_Team>
-
[Optional] Create an authorization object to store the CSP credentials.
Replace
ACCESS_KEY_ID
,SECRET_ACCESS_KEY
, andREGION
with your values.%project_auth_create name=<Auth_Name>, project=<Project_Name>, key=<ACCESS_KEY_ID>, secret=<SECRET_ACCESS_KEy>, region=<REGION>
-
Deploy an 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 takes a few minutes to complete. On successful deployment, a password is generated.
-
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.
-
Run the sample workload.
NoteMake sure that you do not have tables named SalesCenter or SalesDemo in the selected database. -
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 ;
-
Load data into the SalesCenter table using the
%dataload
magic command.%dataload DATABASE=<Project_Name>, TABLE=SalesCenter, FILEPATH=notebooks/sql/data/salescenter.csv
NoteUnable 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
-
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 ;
-
Load data into the SalesDemo table using the
%dataload
magic command.%dataload DATABASE=<Project_Name>, TABLE=SalesDemo, FILEPATH=notebooks/sql/data/salesdemo.csv
NoteUnable 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.
-
Use charting magic to visualize the result.
Provide X and Y axes for your chart.
%chart sales_center_name, sales, title=Sales Data
-
Drop the tables.
DROP TABLE SalesCenter; DROP TABLE SalesDemo;
-
-
Back up your project metadata and object definitions in your GitHub repository.
%project_backup project=<Project_Name>
-
Suspend the engine.
%project_engine_suspend project=<Project_Name>
Congrats! You’ve successfully run your first use case in JupyterLab.