Ad hoc query allows you to test your code in the development environment. This way, you can perform troubleshooting or check whether your code works as expected.
Create a folder
- Go to the DataStudio page.
- Log on to the DataWorks console.
- In the left-side navigation pane, click Workspaces.
- In the top navigation bar, select the region where the target workspace resides. Find the target workspace and click Data Analytics in the Actions column.
- On the left-side navigation submenu, click the Temporary query icon.
You can click the icon in the lower-left corner to show or hide the left-side navigation submenu.
- On the Temporary query tab, move the pointer over the icon and select Folder.
- In the New folder dialog box, enter a name for the folder in the Folder name field and set the Destination folder parameter.
- The folder name must be 1 to 128 characters in length and can contain letters, digits, underscores (_), and periods (.).
- DataWorks supports multi-level folders. You can save a newly created folder under another folder that already exists.
- Click New.
Create an ad hoc query node
On the Temporary query tab, you can create a variety of ad hoc query nodes, such as EMR Hive, ODPS SQL, EMR Spark SQL, EMR Presto, EMR Impala, Shell, AnalyticDB for PostgreSQL, AnalyticDB for MySQL, and Data Lake Analytics nodes.
In this example, create an ODPS SQL node.
- On the Temporary query tab, right-click the folder you created and choose .
- In the New node dialog box, set the Node name and Destination folder parameters.
Note The node name must be 1 to 128 characters in length and can contain letters, digits, underscores (_), and periods (.). It is not case-sensitive.
- Click Submit.
- On the node configuration tab that appears, enter an SQL query statement.
- If the current workspace is bound to multiple MaxCompute compute engines, you must select a desired MaxCompute engine instance before you submit the query statement for execution.
- The selected MaxCompute engine instance may use a default resource group that is charged in pay-as-you-go mode. In this case, you can click the icon in the toolbar to estimate the cost of this operation. The actual cost is included in your bill.
- Click the icon in the toolbar to view the query result.