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

  1. 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.
  2. Click the Ad-Hoc Query icon in the left-side navigation pane. The Ad-Hoc Query tab appears.
  3. Right-click Ad-Hoc Query and choose Create Node > ODPS SQL.
  4. In the Create Node dialog box that appears, set Node Name and Location.
  5. 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.

For example, to create a table, enter the following statement and click Run 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 Expense Estimate dialog box that appears, check the estimated expense of running the SQL statement that you enter, and click Run. Expense Estimate dialog box

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.