Develop and analyze data using DataWorks Notebook

Updated at:
Copy as MD

After the environment is initialized, a DataWorks workspace named `OpenLake Solution Experience` is automatically created in the current region. This workspace is configured with the environment required to run the OpenLake solution, such as an attached resource group for task execution and OpenLake-related engines. You can experience the OpenLake solution in this workspace in the following ways.

Note

To experience the features of the OpenLake solution, you must configure the DataWorks workspace to Use Data Studio (New Version). For details, see Create an OpenLake workspace.

Method 1: Use the built-in example in the workspace

After the environment is initialized, the OpenLake Solution Experience Space workspace contains a built-in Notebook getting-started case. You can use this case to directly experience the capabilities of the OpenLake solution.

Step 1: View the built-in case

In the DataWorks console, on the OpenLake Solution page, click Go to Notebook. You will be redirected to the OpenLake Solution Experience Space DataStudio page to quickly experience the built-in case.

Step 2: Run the OpenLake case

The trial space automatically initializes the runtime environment for the Notebook job, such as a personal development environment. Before running the case, replace the environment variables required by the case with the actual parameters of your OpenLake environment. To obtain information about OpenLake environment variables, use the following methods:

  • To obtain information about computing resources, go to the DataWorks console. In the left-side navigation pane, click Work space to go to the Workspaces page. Click a workspace name to go to the Workspace Details page, and then click the Computing Resources tab to view the bound computing resources. You can also click Associate Computing Resources to bind a new computing resource.

  • For information about DLF, click this link.

# Enter values for global parameters 1-4 below before running the code.
# 1) Replace [dlf_region] with the ID of the region where DLF is located, such as cn-hangzhou, cn-beijing, cn-shanghai, or cn-shenzhen.
dlf_region = "[dlf_region]"
# 2) Replace [dlf_catalog_id] with your DLF data catalog ID. If you have activated the integrated OpenLake solution, we recommend that you use the DLF data catalog ID that corresponds to the name "myfirstcatalog".
dlf_catalog_id = "[dlf_catalog_id]"
# 3) Replace [accessKeyId] with the AccessKey ID of the current Alibaba Cloud account.
accessKeyId = "[accessKeyId]"
# 4) Replace [accessKeySecret] with the AccessKey secret of the current Alibaba Cloud account.
accessKeySecret = "[accessKeySecret]"
# The VPC endpoint of the DLF service and the endpoint for Hologres to access DLF are pre-configured. You do not need to modify the following configurations.
dlf_endpoint = f"dlfnext-vpc.{dlf_region}.aliyuncs.com"
dlf_endpoint_for_holo = f"dlfnext-share.{dlf_region}.aliyuncs.com"

Method 2: Import an example

DataWorks Gallery provides classic Notebook cases. You can run these tutorials directly in DataWorks or adapt them to your business scenarios.

Step 1: Import from Gallery

  1. On the OpenLake Solution page, click View Event Cases to go to the practice cases page: DataWorks Gallery.

  2. On the DataWorksGallery page, search for OpenLake solution Quick Start in All Categories.

    • Method 1: After you find the case, click the Load Case button in the lower-right corner of the case card. In the dialog box that appears, configure the Work space and the personal development environment instance, and then click OK to import the case.

    • Method 2: Click the case title to view its details. On the details page, click Load Case. In the dialog box that appears, configure the Work space and the personal development environment instance, and then click OK to import the case.

Step 2: Go to DataStudio

When you load a case, you are automatically redirected to the DataStudio page in DataWorks. You can also go to DataStudio by using the following method.

On the DataWorks console > OpenLake Solution page, click Go to Notebook. You will be redirected to the OpenLake Solution Experience Space DataStudio page.

Step 3: Run the OpenLake case

Follow Step 2 in Method 1: Use the built-in case to replace the variables required by the case with the actual values of your OpenLake environment. Then, run the case.