Updated on 2023-09-19 GMT+08:00

Prerequisites

Registering a Huawei ID and Enabling Huawei Cloud Services

  1. Log in to the Huawei Cloud website.
  2. Click Register at the upper right corner of the page.
  3. Complete the registration as instructed.

    Select the agreement as prompted to enable Huawei Cloud services.

Enabling DLI

  1. Log in to the management console and click Service List from the top menu.
  2. Click Data Lake Insight under Enterprise Intelligence.
  3. Click Access Console to switch to the DLI management console.

Downloading SDK

  1. Log in to the DLI management console.
  2. On the Overview page, click SDK Download under Helpful Links.

    You are advised to download the .sha256 file corresponding to the SDK installation package. This file can be used to verify the integrity of the package.

    Figure 1 Downloading the SDK installation package
  3. On the displayed DLI SDK DOWNLOAD page, click the target link to obtain the desired SDK installation package.
    Currently, DLI provides the SDK installation packages of the Java and Python versions.
    • Java SDK

      Obtain the dli-sdk-java-x.x.x.zip package and decompress it. The following table shows the directory structure of the package.

      Table 1 Directory structure

      Parameter

      Description

      jars

      SDK and its dependent JAR packages.

      maven-install

      Script and JAR package that are installed in the local Maven repository.

      dli-sdk-java.version

      Java SDK version description.

      If Maven is used, add the following Maven configuration items on which huaweicloud-dli-sdk-java depends:
      1
      2
      3
      4
      5
       <dependency>
          <groupId>com.huawei.dli</groupId>
          <artifactId>huaweicloud-dli-sdk-java</artifactId>
          <version>x.x.x</version>
       </dependency>
      

      You can obtain the latest version number from the Maven configuration.

      DLI depends on SDKs (for example, OBS SDK), which can be downloaded by configuring the Maven image source repository of Huawei Cloud.
      • Use the Huawei image source as the main repository:

        For details about how to configure the Huawei Maven image source, visit Huawei open source image site, select Huawei SDK, and click HuaweiCloud SDK.

        If you build a project with Maven, modify the settings.xml file by adding the following content:

        1. Add the following content to the profiles node:
          <profile>
              <id>MyProfile</id>
              <repositories>
                  <repository>
                      <id>HuaweiCloudSDK</id>
                      <url>https://repo.huaweicloud.com/repository/maven/huaweicloudsdk/</url>
                      <releases>
                          <enabled>true</enabled>
                      </releases>
                      <snapshots>
                          <enabled>false</enabled>
                      </snapshots>
                  </repository>
              </repositories>
              <pluginRepositories>
                  <pluginRepository>
                      <id>HuaweiCloudSDK</id>
                      <url>https://repo.huaweicloud.com/repository/maven/huaweicloudsdk/</url>
                      <releases>
                          <enabled>true</enabled>
                      </releases>
                      <snapshots>
                          <enabled>false</enabled>
                      </snapshots>
                  </pluginRepository>
              </pluginRepositories>
          </profile>
        2. Add the following information to the mirrors node:
          <mirror>
              <id>huaweicloud</id>
              <mirrorOf>*,!HuaweiCloudSDK</mirrorOf>
              <url>https://repo.huaweicloud.com/repository/maven/</url>
          </mirror>
        3. Add the activeProfiles tag to activate the configurations.
          <activeProfiles>
            <activeProfile>MyProfile</activeProfile>
          </activeProfiles>
      • Use a non-Huawei image source as the main repository (for example, a user-defined image source) to use HuaweiCloud SDK:

        If you build a project with Maven, modify the settings.xml file as follows:

        <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
            <servers>
        	 <server>
              <id>demo-releases</id>    
              <username>deployment</username>    
              <password><![CDATA[xxx]]></password>  
            </server>    
          </servers>
          <mirrors>
            <mirror>     
              <id>demo-releases</id>     
              <mirrorOf>*,!HuaweiCloudSDK</mirrorOf>     
              <url>http://maven.demo.com:8082/demo/content/groups/public</url>     
            </mirror>    
          </mirrors>
          <profiles>
            <profile>    
              <id>demo</id>
              <activation>
                <activeByDefault>true</activeByDefault>
                <jdk>1.8</jdk>
              </activation> 
              <properties>
                <maven.compiler.source>1.8</maven.compiler.source>
                <maven.compiler.target>1.8</maven.compiler.target>
                <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> 
              </properties>
              <repositories>    
                 <repository>    
                  <id>demo-releases</id>    
                  <url>http://demo-releases</url>    
                  <releases>
                    <enabled>true</enabled>
                  </releases>    
                  <snapshots>
                    <enabled>true</enabled>
                  </snapshots>    
                </repository> 
              </repositories>
              <pluginRepositories>    
                 <pluginRepository>    
                    <id>demo-releases</id>    
                    <url>http://demo-releases</url>    
                    <releases>
                      <enabled>true</enabled>
                    </releases>    
                    <snapshots>
                      <enabled>true</enabled>
                    </snapshots>    
                  </pluginRepository>
              </pluginRepositories>    
            </profile>
            <profile>
              <id>huaweicloudrepo</id>
              <repositories>
                <repository>
                  <id>HuaweiCloudSDK</id>
                  <url>https://repo.huaweicloud.com/repository/maven/huaweicloudsdk/</url>
                  <releases>
                    <enabled>true</enabled>
                  </releases>
                  <snapshots>
                    <enabled>false</enabled>
                  </snapshots>
                </repository>
              </repositories>
              <pluginRepositories>
                <pluginRepository>
                  <id>HuaweiCloudSDK</id>
                  <url>https://repo.huaweicloud.com/repository/maven/huaweicloudsdk/</url>
                  <releases>
                    <enabled>true</enabled>
                  </releases>
                  <snapshots>
                    <enabled>false</enabled>
                  </snapshots>
                </pluginRepository>
              </pluginRepositories>
            </profile> 
          </profiles>
          <activeProfiles>
            <activeProfile>demo</activeProfile>
            <activeProfile>huaweicloudrepo</activeProfile>
          </activeProfiles>
        </settings>

    • Python SDK

      Obtain the dli-sdk-python-x.x.x.zip package and decompress it. The following table shows the directory structure of the package.

      Table 2 Directory structure

      Parameter

      Description

      dli

      DLI Python SDK package.

      examples

      Example of using the SDK.

      pyDLI

      Connector for Python to connect to DLI SQL, which is implemented based on pyHive.

      setup.py

      SDK installation script.