You can use the ad hoc query feature provided by DataStudio to execute SQL statements in the MaxCompute project associated with your DataWorks workspace.

Create an ad hoc query node

  1. Log on to the DataWorks console.
  2. In the left-side navigation pane, click Workspaces.
  3. In the top navigation bar, select the region where the workspace that you want to manage resides. Find the workspace in the list and click Data Analytics in the Actions column.
  4. On the left-side navigation submenu, click the Ad Hoc Query icon.
  5. In the Ad Hoc Query pane, right-click Ad Hoc Query and choose Create Node > ODPS SQL.
  6. In the Create Node dialog box, set the Node Name and Location parameters.
    Note The node name must be 1 to 128 characters in length.
  7. Click Commit.

Execute SQL statements

After the ad hoc query node is committed, you can execute SQL statements supported by MaxCompute in the node. For more information, see MaxCompute SQL overview.

For example, to create a table, enter the following statement and click the Run icon icon:
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.
In the Estimate MaxCompute Computing Cost dialog box, check the estimated expense of executing the SQL statement that you enter, and click Run. Estimate MaxCompute Computing Cost dialog box

View the execution details and result in the Runtime Log section. If the SQL statement is successfully executed, the result is shown as OK.

You can execute SQL query statements in the same way.