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


Create an ad-hoc query node
  1. On the Workspaces page in the DataWorks console, find the target workspace and click Data Analytics in the Actions column.
    Access Data Analytics
  2. Create an ODPS SQL node. In the left-side navigation pane, click Ad-Hoc Query. Right-click Ad-Hoc Query and choose Create Node > ODPS SQL.
    Ad-hoc query
  3. In the Create Node dialog box that appears, set Node Name and click Commit.
Run an SQL statement
  1. Write an SQL statement in the created ad-hoc query node and click Run an SQL statement.
    -- 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 running the SQL statement. Click Run if you decide to run the SQL statement.
  3. View the running status and result in the operational logs. If the running is successful, the result is shown as OK.