You can use the ad-hoc query feature provided by DataStudio to execute SQL statements in a selected DataWorks workspace (MaxCompute project) that you have created.


Create an ad-hoc query node
  1. Log on to the DataWorks console.
  2. In the left-side navigation pane, click Workspaces.
  3. After you select the region where the required workspace resides, find the workspace and click Data Analytics.
  4. Create an ODPS SQL node.
    1. In the left-side menu bar, click the Ad-Hoc Query icon.
    2. Right-click Ad-Hoc Query and choose Create Node > ODPS SQL.
  5. In the Create Node dialog box, set Node Name and click Commit.
Execute an SQL statement
  1. Write an SQL statement in the created ad-hoc query node and click the Run icon.
    -- Create a partitioned table named sale_detail.
    CREATE TABLE if not exists sale_detail
    shop_name     string,
    customer_id   string,
    total_price   double
    partitioned by (sale_date string,region string);
    Note For more information about the SQL statements supported by ad-hoc queries, see SQL statements supported by MaxCompute.
  2. View the estimated costs before you execute the SQL statement. Click Run to execute the SQL statement.
    Expense Estimate dialog box
  3. View the running status and result in the operational logs. If the SQL statement is successfully executed, OK is displayed.
    Execution succeeded