Create a MaxCompute script module

Updated at:

MaxCompute supports SQL in script mode. In this mode, MaxCompute compiles and submits a multi-statement SQL script as a single unit, generating one execution plan. This process ensures the script is queued and executed only once, optimizing resource use. Because MaxCompute Studio uses script mode for SQL development, you must first create a MaxCompute script module. This topic describes how to create one.

Background

You can create a MaxCompute script module in two scenarios:

  • No local script files: If you have no local script files, create a new module in IntelliJ IDEA.

  • Existing local script files: If you have existing script files in a local folder, you can open the folder directly as a module in MaxCompute Studio to edit them.

Create a new module

  1. Start IntelliJ IDEA. In the top menu bar, choose File > New > Project.

  2. In the New Project dialog box, select MaxCompute Studio from the left navigation pane and click Next.

    新建项目

  3. Enter a Project name and click Finish to create the project.

    配置项目名称

    Note

    If another project is already open, you are prompted to choose where to open the new project. Select This Window to open it in the current window and close the previous project.

Create a module from existing script files

If you have existing local script files, you do not need to create a new module. Instead, add a MaxCompute connection configuration file to the directory that contains your scripts.

  1. In your local .\IdeaProjects\MaxCompute_Studio_Project_Name\scripts folder, create a MaxCompute connection configuration file named odps_config.ini. This file contains the credentials for your MaxCompute connection:

    # The name of the MaxCompute project.
    project_name=<your_project_name>
    # The AccessKey ID of your Alibaba Cloud account.
    access_id=<your_access_key_id>
    # The AccessKey secret of your Alibaba Cloud account.
    access_key=<your_access_key_secret>
    # The endpoint of the region where your MaxCompute service is located.
    end_point=<your_endpoint>
  2. In IntelliJ IDEA, choose File > Open and select the odps_config.ini file from your local .\IdeaProjects\MaxCompute_Studio_Project_Name\scripts folder.

    Note

    MaxCompute Studio automatically finds the odps_config.ini file in the folder. It then uses this configuration to fetch metadata from the MaxCompute server and compile all scripts in the folder.