You can use the ad hoc query feature provided by DataStudio to quickly run SQL statements in the MaxCompute project associated with your DataWorks workspace.
For more information about the ad hoc query feature, see Create an ad hoc query.
Create an ad hoc query node
- Log on to the DataWorks console. In the left-side navigation pane, click Workspaces. On the Workspaces page, find the target workspace and click Data Analytics in the Actions column.
- Click the Ad-Hoc Query icon in the left-side navigation pane. The Ad-Hoc Query tab appears.
- Right-click Ad-Hoc Query and choose .
- In the Create Node dialog box that appears, set Node Name and Location.
- Click Commit.
Run SQL statements
After committing the ad hoc query node, you can run SQL statements supported by MaxCompute in the node. For more information, see SQL statement overview.
create table if not exists sale_detail ( shop_name string, customer_id string, total_price double ) partitioned by (sale_date string,region string); -- Create a partitioned table named sale_detail.
View the running status and results in the Runtime Log section. If the SQL statement is run successfully, the result is shown as OK.
You can run SQL query statements in the same way.