DataWorks DataAnalysis lets you query data and visualize results as charts without writing additional code. This topic walks you through an end-to-end example: querying user profile data with SQL and generating charts to analyze registration and engagement patterns.
Prerequisites
Before you begin, ensure that you have:
-
Processed data available for querying. In this example, user profile data processed with DataWorks DataStudio
-
Query permissions on the target data source. To grant permissions, go to Security Center > Security policy > Data query and analysis control > Queryable data source, find the data source, and click Authorization in the Actions column. For details, see Use the data query and analysis control feature
Scenarios covered in this example
This example covers the following user profile visualization scenarios.
|
Scenario |
Chart |
|
Numbers of registered members in different provinces and cities |
<img> |
|
Distribution of page views of members in different age ranges |
<img> |
|
Distribution of page views of members by gender |
<img> |
|
Numbers of page views of members counted by gender and zodiac sign |
<img> |
Visualize data with SQL Query
Step 1: Go to the SQL Query page
Log on to the DataWorks console. In the top navigation bar, select the target region. In the left-side navigation pane, choose Data Analysis and Service > DataAnalysis. Click Go to DataAnalysis, then click SQL Query in the left-side navigation pane.
Step 2: Create an SQL query file
On the SQL Query page, create a temporary file using one of these methods:
-
If no SQL query file is open, click Create SQL Query in the right-side area.
-
If an existing SQL query file is open, click the
icon to the right of the file name.
For more information about SQL query files, see SQL query.
Step 3: Select a data source
On the configuration tab of the SQL query file, click the
icon in the upper-right corner. Select a workspace, a compute engine type, and a data source. This example uses a MaxCompute data source.
Step 4: Write and run the SQL statement
On the configuration tab, enter the following SQL statement and click the
icon to run the query. This example queries the dt="20241126" partition of the ads_user_info_1d table.
-- If the desired partition is not found, you can run the show partitions tablename command to view and confirm the table partition.
select * from ads_user_info_1d_odps where dt='Data timestamp';
Step 5: Switch to chart view
After the query completes, click the
icon on the left side of the query result section to visualize the query result.

Step 6: Modify the chart
Click the
icon in the upper-right corner of the chart to open the chart configuration tab and modify the chart.
What's next
|
Action |
Steps |
|
Save and share the chart |
Click Save in the upper-right corner to permanently save your changes and then share the chart. |
|
Create charts with other chart types |
Click Save As to visualize processed data by using other types of charts. |
|
Browse saved charts |
In the left-side navigation pane of the DataAnalysis page, click Cards to view the charts on which you perform the Save As operation. |