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
Start IntelliJ IDEA. From the main menu, select .
In the left navigation pane of the New Project dialog box, select MaxCompute Studio and click Next.
Enter a Project name and click Finish to create the project.
NoteIf a project is already open, you are prompted whether to open the new project in the current window. Click This Window to close the existing project and open the new one.
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.
-
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> -
In IntelliJ IDEA, choose and select the odps_config.ini file from your local .\IdeaProjects\MaxCompute_Studio_Project_Name\scripts folder.
NoteMaxCompute 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.