Use Copilot and Enhanced Analysis for one-stop intelligent data queries and visualization
DataWorks Copilot is your intelligent assistant in DataWorks. You can use the default DataWorks model, Qwen3-235B-A22B, DeepSeek-R1-0528, or Qwen3-Coder for Copilot operations. With DeepSeek-R1's reasoning capabilities, DataWorks Copilot helps you generate, optimize, and test complex SQL through natural-language conversations, improving ETL development and data analysis efficiency. This topic shows how to use Copilot and Enhanced Analysis for one-stop intelligent data queries and visualization.
Important notes
-
DataWorks Copilot's public preview is currently limited by region and edition. For details, seeCoding Assistant.
-
For SQL used in this tutorial, seeAppendix: SQL code for all cards in the report.
Prepare the environment
Enable DataWorks
-
Log onFree Trial.
Go toAlibaba Cloud Free Trial. In the upper-right corner, clickLog On/Sign Upand follow the on-screen instructions to log on.
-
Log on: If you already have an Alibaba Cloud account, log on directly.
-
Sign up: If you do not have an Alibaba Cloud account, create one.
-
Identity verification: Complete personal or enterprise identity verification as required for the trial product.
-
-
After logging on, on theFree Trialpage, clickDataWorksproduct'sTry Now.
-
In theDataWorksproduct purchase panel, select the regionChina (Shanghai), select the service agreement, and clickConfirm Order and Pay. Follow the on-screen instructions to enable DataWorks.
Enable MaxCompute
This tutorial also uses MaxCompute. Go to theApply for MaxCompute Free Trialpage and apply for a free MaxCompute resource package inFree Trialto complete this tutorial. For supported regions and free quotas, seeFree trial quotas for new users.
-
If you have previously applied for a MaxCompute free trial, log on to theMaxCompute consoleto check whether theChina (Shanghai)region is enabled. If it is not, clickEnable MaxCompute Nowon the welcome page.
-
If you are not eligible for the free MaxCompute trial, you canenable pay-as-you-go MaxCompute. For billing details, seeBilling overview.
Create a MaxCompute data source in DataWorks
-
Log onMaxCompute console. In the upper-left corner, select theChina (Shanghai)region used in this tutorial.
-
In the left navigation pane, clickWorkspace Project Management. On the project list page, clickCreate Project.
-
and follow the on-screen instructions. Key parameters are described below.
Parameter
Description
Project name
Specify a custom project name. This tutorial usesdoc_test_000.
Project names must be globally unique. If the name already exists, change it as prompted.
Compute resource billing method
Specifies how the MaxCompute project is billed. This tutorial selectsPay-as-you-go.
NoteResource packages purchased through the free trial can only offset pay-as-you-go resource consumption.
Default quota
Allocates compute resources. This tutorial selectsDefault pay-as-you-go quota.
Single SQL consumption limit
Optional. This tutorial does not set it.
This parameter sets the maximum cost of one SQL statement, measured as scanned data (GB) times complexity. When using thePay-as-you-gobilling method, set this limit to avoid unexpectedly high charges for a single query. Also configure real-time consumption monitoring and alerts. For details, seeConsumption monitoring alert.
Data type
MaxCompute data types includeData Type 1.0,Data Type 2.0, andHive-compatible types. This tutorial selectsData Type 2.0.
Encryption
Specifies whether data encryption is enabled for the MaxCompute project. For details, seeStorage encryption. This tutorial selectsNo Encryption.
-
After configuration, clickOKto create the project.
Bind the MaxCompute project
-
Open the DataWorks workspace Management Center.
-
Log onDataWorks console. In the upper-left corner, select theChina (Shanghai)region used in this tutorial.
-
In the left navigation pane, clickWorkspacesto open theWorkspace Listpage. Find the workspace to bind to MaxCompute. This tutorial uses the default workspace, but you can use a workspace you created.
-
In theActionscolumn of the workspace, clickManageto open Management Center.
-
-
Create the MaxCompute project as a data source.
-
In the left navigation pane of Management Center, clickData Sourcesto open the data source management page.
-
ClickAdd Data Sourceand search for MaxCompute to create the data source.
-
Configure data source information.
Key parameters are described below.
Parameter
Description
Data source name
The unique name of the data source in DataWorks. This tutorial usesdoc_test_000.
Authentication method
By default, use the Alibaba Cloud account and RAM role for authentication.
Cloud account
Select the current Alibaba Cloud main account.
Region
Select China (Shanghai).
MaxCompute project name
Select the project created in this tutorial:doc_test_000.
Default access identity
Select the Alibaba Cloud main account.
NoteFor a workspace in standard mode, selectExecutorfor the development environment, and selectAlibaba Cloud main account for the production environment..
Endpoint
SelectAuto-detect.
For more data source settings, seeAssociate a MaxCompute compute resource.
-
Test Serverless resource group connectivity.
Test connectivity between the required Serverless resource group and the data source. If they cannot connect, the relevant data source tasks cannot run. For details, see:Network connectivity configuration.
-
-
Bind the MaxCompute data source to DataWorks Data Development.
On the Management Center page, clickto open Data Development. In the left navigation pane, clickCompute Resourcesand follow the on-screen instructions to bind the data source created above to Data Development.
EnableCopilot
If you meet the public preview requirements, join the Copilot public preview. For details, seeCoding Assistant.
Try Copilot features such as SQL generation in DataWorks
-
Open Copilot.
On theDataStudio (Data Development)page, click the icon on the right side of the top menu barCopilotto open Copilot.
-
to check whether theCopilotSupported operations.
On theCopilotIn the dialog box (calledCopilot Chatbelow), enter"/"to viewCopilotthe supported operations. Select an operation and describe your request in natural language, or enter your request directly.
Choose an operation as needed, as described below.
Actions
Description
Quick table search
In Copilot Chat, enter a request such as "website user page access log table". In Copilot results, click the radio button before the table you want. Subsequent SQL operations use that table.
SQL generation
In Copilot Chat, enter a request such as "page view counts by time period" and click Send. Wait for Copilot to respond.
Create node
After generating SQL, insert it into the current node or a new node.
For example, in the Chat response, clickInsert into New Nodeat the upper-right of the SQL snippet. A new ODPS SQL node is created with the generated SQL.
SQL rewrite
Click SQL Rewrite. In the input box, enter a request such as "Write the results to partitioned table dws_ali_e_commerce and generate its CREATE TABLE statement". Then click Send and wait for Copilot to respond.
Generate comments
The DDL generated above lacks column COMMENT descriptions, making its fields harder for users to understand after the task is published. Use Copilot's Generate Comments feature to add COMMENT descriptions.
In the editor, right-click the SQL and select, then clickSend. Wait for Copilot's response.
SQL error correction
In the editor, right-click the SQL and select, then clickSend. Wait for Copilot's response.
SQL explanation
Select the SQL in the editor and click the icon at the top of the pageCopilot. In the Chat dialog box, enter a request such as "Explain this SQL" and clickSend. Wait for Copilot's response.
Scheduling configuration
Configure scheduling before publishing the completed data development code as a scheduled task.
In the Chat dialog box, enter a request such as "Set the scheduled time to 02:00 every day and allow reruns" and clickSend. Wait for Copilot's response.
Submit task
After configuring scheduling for the completed code, submit the task.
Under the scheduling configuration card in Chat, clickApply and Submit Nodeto start task submission.
Try data queries in DataWorks
-
On the openDataStudio (Data Development)page, click the icon in the upper-left corner
and selectAll Products>Data Analysis>SQL Query. -
On the DataWorksSQL Querypage, a new SQL Query page is created by default. Copy the SQL generated above to this page.
SELECT CASE WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 0 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 3 THEN '00:00-03:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 3 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 6 THEN '03:00-06:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 6 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 9 THEN '06:00-09:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 9 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 12 THEN '09:00-12:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 12 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 15 THEN '12:00-15:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 15 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 18 THEN '15:00-18:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 18 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 21 THEN '18:00-21:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 21 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 24 THEN '21:00-24:00' ELSE 'Other' END AS time_period ,COUNT(1) as page_view_count FROM public_cloud_simple.dwd_ali_e_commerce WHERE behavior_type = 1 GROUP BY time_period order by time_period; -
Click the icon in the upper-right corner of the SQL query fileto set the workspace and engine.
-
After setting them, click Run in the SQL query file toolbar. When the query succeeds, results appear below the SQL file.
Create an Enhanced Analysis card in DataWorks
In the SQL results area, to visualize the results, click theicon. A chart is generated by default.
-
If the default chart does not meet your needs, click the icon in its upper-right cornerto open the chart editor.
This tutorial shows how to change the titles of the chart's horizontal and vertical axes.
-
On the right side of the chart editor, click.
-
ClickAxis Titlefor the X and Y axes and edit the titles. Then clickSavein the upper-right corner to return to the SQL results page.
-
-
If the default or edited chart meets your needs, click the icon in its upper-right cornerSaveto save and share it. Click the icon in the primary menu on the leftto view saved cards.

Create an Enhanced Analysis report in DataWorks
To share several cards saved in DataWorks as a report with charts, descriptions, and a logical flow, create a report.
-
Click the report icon in the primary menu on the left. On the report list page, in the upper-right corner clickCreate Report.
-
In the dialog box, select the cards to include in the report.
-
Click the button in the lower-right corner of the dialog boxOKto return to the report editor.
-
To reorder cards, drag them in the card order editor on the left.
-
To change the report title, double-click it and enter the desired title.
This tutorial changes the title to "User Analysis Report for a Shopping App". Select a report theme on the right. In theReport Settingspanel, switch theReport LayoutbetweenLong ImageandDashboard, and choose a color scheme underReport Theme. At the bottom of the card order panel on the left, clickAdd Cardto add more cards.
-
-
ClickCreatein the upper-right corner to return to the report list. Hover over the report to share and click the icon in its upper-right corner. Copy the share link in the dialog box and send it to your recipients. The report link in this tutorial isUser Analysis Report for a Shopping App.
Upload custom data to MaxCompute
In daily work, you may need to upload a local file once to a compute engine for large-scale processing or analysis with other online data. Follow these steps:
-
On the open SQL Query page, click the icon in the upper-left cornerand selectAll Products>Data Integration>Upload and Download.
-
Click the upload icon in the left navigation paneto open the data upload page.
-
ClickData Uploadand follow the on-screen instructions to upload data.
You can upload a local .csv file to an existing table in a MaxCompute project or create a new MaxCompute table during upload. This tutorial uploads the local file "2013-2020 Global PS4 Game Sales.csv" to the MaxCompute projectpublic_cloud_simple_devin the new tabledws_game_salse_ndas an example.
Configure these key parameters:
-
Specify data to upload:Select the file "2013-2020 Global PS4 Game Sales.csv". For the file, see2013-2020 Global PS4 Game Sales.csv.
-
Set target table:Select the MaxCompute project doc_test_000, set Target Table to Create Table, set Table Name to dws_game_salse_nd, Table Type to Non-partitioned Table, Lifecycle to 365 days.
After configuration, check the data inUploaded File Data Preview. If text appears garbled, change theFile Encoding.
-
-
Click the button in the lower-left cornerData Uploadto start the upload.
In the dialog box, you can track upload progress. Closing it does not stop the upload. You can also clickReturn to Listto view upload progress or start another upload.
-
After the upload finishes, you can:
-
View whether the upload succeeded or failed and when it ended.
-
ClickData Queryto query the uploaded data and analyze it with other data.
-
Start another upload or return to the upload list for details.
-
These steps show how to manually upload local data once to MaxCompute. To schedule synchronization of business data to MaxCompute or another big-data compute engine, use DataWorks Data Integration. For details, seeData Integration.
Appendix:SQL used by all cards in the report
-
Page view counts by time period
SELECT CASE WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 0 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 3 THEN '00:00-03:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 3 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 6 THEN '03:00-06:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 6 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 9 THEN '06:00-09:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 9 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 12 THEN '09:00-12:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 12 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 15 THEN '12:00-15:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 15 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 18 THEN '15:00-18:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 18 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 21 THEN '18:00-21:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 21 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 24 THEN '21:00-24:00' ELSE 'Other' END AS time_period ,COUNT(1) as page_view_count FROM public_cloud_simple.dwd_ali_e_commerce WHERE behavior_type = 1 GROUP BY time_period order by time_period; -
High-frequency order periods
SELECT CASE WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 0 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 3 THEN '00:00-03:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 3 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 6 THEN '03:00-06:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 6 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 9 THEN '06:00-09:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 9 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 12 THEN '09:00-12:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 12 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 15 THEN '12:00-15:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 15 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 18 THEN '15:00-18:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 18 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 21 THEN '18:00-21:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 21 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 24 THEN '21:00-24:00' ELSE 'Other' END AS time_period ,COUNT(DISTINCT user_id) AS order_user_count FROM public_cloud_simple.dwd_ali_e_commerce WHERE behavior_type = '4' GROUP BY time_period ORDER BY time_period ASC LIMIT 100 ; -
Number of users placing orders by time period
SELECT CASE WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 0 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 3 THEN '00:00-03:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 3 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 6 THEN '03:00-06:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 6 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 9 THEN '06:00-09:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 9 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 12 THEN '09:00-12:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 12 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 15 THEN '12:00-15:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 15 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 18 THEN '15:00-18:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 18 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 21 THEN '18:00-21:00' WHEN CAST(SUBSTR(behavior_time,12) AS BIGINT) >= 21 AND CAST(SUBSTR(behavior_time,12) AS BIGINT) < 24 THEN '21:00-24:00' ELSE 'Other' END AS time_period ,COUNT(DISTINCT user_id) AS order_user_count FROM public_cloud_simple.dwd_ali_e_commerce WHERE behavior_type = '4' GROUP BY time_period ORDER BY time_period ASC LIMIT 100 ; -
User behavior trends over time
SELECT CAST(SUBSTR(behavior_time,12) AS BIGINT) AS time_period ,CASE WHEN behavior_type = '1' THEN 'Product page view' WHEN behavior_type = '2' THEN 'Product favorite' WHEN behavior_type = '3' THEN 'Add to cart' WHEN behavior_type = '4' THEN 'Purchase' ELSE behavior_type END AS user_action ,COUNT(DISTINCT user_id) AS user_count FROM public_cloud_simple.dwd_ali_e_commerce WHERE behavior_type IN ('1','3','4') GROUP BY time_period ,user_action ORDER BY time_period ASC LIMIT 10000 ; -
Number of buyers or viewers
SELECT CASE WHEN behavior_type = '1' THEN 'Product page view' WHEN behavior_type = '2' THEN 'Product favorite' WHEN behavior_type = '3' THEN 'Add to cart' WHEN behavior_type = '4' THEN 'Purchase' ELSE behavior_type END AS behavior_type ,COUNT(DISTINCT user_id) AS order_user_count FROM public_cloud_simple.dwd_ali_e_commerce GROUP BY behavior_type ORDER BY order_user_count DESC LIMIT 10000 ; -
Distribution of online shopping order times
SELECT CAST(SUBSTR(behavior_time,12) AS BIGINT) AS time_period ,COUNT(DISTINCT user_id) AS user_count FROM public_cloud_simple.dwd_ali_e_commerce WHERE behavior_type IN ('4') GROUP BY time_period ORDER BY time_period ASC LIMIT 10000 ;
> All Products > Data Development and O&M > DataStudio (Data Development)