The SQL engine of MaxCompute supports the script mode. In script mode, an SQL script that contains multiple SQL statements is compiled and submitted as a whole to generate an execution plan. The SQL script needs to queue and to be executed only once, which ensures that resources can be fully utilized. The script mode is used when you use MaxCompute Studio to develop SQL programs. Before you use MaxCompute Studio to develop SQL programs, you must create a MaxCompute script module. This topic describes how to create a MaxCompute script module.
Background information
Before you create a MaxCompute script module, you must check whether a local script exists.
If no local script exists, you need to use IntelliJ IDEA to create a MaxCompute script module.
If a local script exists, you do not need to create a MaxCompute script module. You can directly open a MaxCompute script module and use MaxCompute Studio to edit the script.
Create a MaxCompute script module if no local script exists
Start IntelliJ IDEA. In the main menu bar, choose .
In the left-side navigation pane of the New Project dialog box, click MaxCompute Studio. Then, click Next.
Specify Project name and click Finish.
NoteIf a project is open, a dialog box appears and asks whether you want to open the new project in a new window or the current window. In this case, click This Window.
Create a MaxCompute script module if a local script exists
If a local script exists, you do not need to create a MaxCompute script module. You need to only create a MaxCompute connection configuration file in the existing module directory.
In the .\IdeaProjects\MaxCompute_Studio_Project_Name\scripts folder, create a MaxCompute connection configuration file named odps_config.ini and configure the following authentication information. The authentication information is used to connect to MaxCompute.
# The name of the MaxCompute project to be connected. project_name=xxxxxxxx # The AccessKey ID of your Alibaba Cloud account. access_id=xxxxxxxxxx # The AccessKey secret of your Alibaba Cloud account. access_key=xxxxxxxxx # The endpoint of the region where your MaxCompute service is deployed. end_point=xxxxxxxxx
Open IntelliJ IDEA. In the top navigation bar, choose odps_config.ini file in the .\IdeaProjects\MaxCompute_Studio_Project_Name\scripts folder. , and then select the
NoteMaxCompute Studio automatically searches for the odps_config.ini file in the folder and captures the metadata on the MaxCompute server based on the configuration information in the file. MaxCompute Studio then compiles all scripts in the folder.