Automatically build semantic views
Use SQL inputs to build semantic view drafts in AnalyticDB for MySQL. Review and edit the drafts, then adopt them to create semantic views.
Prerequisites
Semantic views are in public preview and are not available in all regions. Submit a ticket or contact technical support to request access.
A RAM user is associated with a database account. For the procedure, see Associate or disassociate a database account with or from a RAM user.
The databases, tables, and columns referenced by the SQL exist in the target cluster. Their names match the actual objects.
Semantic views use the same database permissions as regular AnalyticDB for MySQL views. Adopting a draft requires CREATE VIEW on the target object scope and SELECT on referenced objects. Viewing a definition requires SHOW VIEW and SELECT. For authorization details, see Database permission model.
Access automatic semantic view recommendations
Log on to the AnalyticDB for MySQL console, select a region, and go to the target cluster.
In the navigation pane, choose Data Management > Automatic View Recommendation and click the Semantic Views tab.
The page lists build tasks. Click Details in a task row to open its tab and view the materials, build status, and generated results.
Build tasks
The task list provides the following operations:
Operation | Console operation |
Create a task | Click Create Task to open the form. Task Name is optional. Target Database is required and specifies the database in which adopted views are created. After submission, the new task appears in the list. |
View a task | The list shows the target database, generated content, status, and creation time. Click Details to open a task. |
Refresh the list | Click Refresh to retrieve the latest task status and results. |
Task details show material preparation or draft confirmation controls, depending on the current stage. During Confirm Adoption, the draft list shows semantic views generated by the build.
SQL materials
Upload files
During Prepare Materials, use Upload File to add build inputs. The upload dialog provides the following settings:
Setting | Description |
File selection | Only .sql files are supported. Each file must not exceed 2 MB. Select one file at a time. |
Business meaning | Describe the query purpose, time definitions, filtering scope, and calculation rules that require attention. |
Importance | Choose High, Normal, or Reference. The default is Normal. Use High for core analytical inputs, Normal for routine business queries, and Reference for background materials. |
Click OK to upload the file. Upload additional SQL files individually to use them in the same build. The material list shows file names, sizes, and upload status. Click Refresh for the latest results.
Use representative queries for the same business subject. Preserve complete aggregation expressions, filters, and join conditions. Uploaded materials help generate semantic definitions; they do not import business data or execute the SQL.
Start a build and inspect its inputs
Start Build submits all materials in the current task. Before submission, confirm that every required file has been uploaded.
Materials cannot be changed after the build starts. To add or correct materials, create a new task with the complete revised inputs. Use Context Input in task details to review the submitted materials.
Click Refresh to update the build status. A successful build displays generated drafts. One task may produce several drafts; files and drafts do not necessarily correspond one to one.
Review and edit drafts
Click Details in the draft list to open Semantic View Details. The details page provides Overview and YAML views.
Page area | Available operations |
View information | View the name and business description. Use the adjacent Edit control to make and save changes. |
Overview | Expand logical tables to inspect dimensions, facts, metrics, and filters. View derived metrics, relationships, and verified queries at view level. Use each available Edit control to make changes. |
YAML | View the complete definition and copy or download it as needed. This tab is read-only. |
Available fields depend on the semantic object form. Click Save and Synchronize YAML to update the draft definition. Reopen the object or switch to YAML to verify the changes. Saving a draft does not create or update an adopted view.
Review physical table mappings, columns, calculation expressions, filters, and the logical tables and join columns in each relationship. Follow the object structure in Semantic YAML specification. For console locations and editing controls, see View and manage semantic views.
Adopt drafts
Adopting a reviewed draft creates a semantic view in the database. The console provides these entry points:
Entry point | Purpose |
Adopt in a draft row | Adopt the draft in the current row. |
Adopt This View in draft details | Adopt the draft that is currently open. |
Batch Adopt in the draft list | Adopt the selected drafts. |
Adoption submits immediately. First verify the target database, view name, and draft content. A successful adoption changes the draft status to Adopted. Build succeeded means drafts were generated; only Adoption succeeded means database views were created.
Find adopted views under Data Management > Data Catalog > target database > Semantic Views. Click a view name to inspect the saved definition, manage the view, or run DryRun validation.
If a name conflicts with an existing view, inspect that object first. To create a separate view, rename and save the draft before adopting it. Modify an existing view through its management page.
Troubleshooting
Issue | Resolution |
File upload fails | Check the file format, size, and error message. Confirm that the upload succeeds before starting the build. |
Build fails | Inspect the task error. Verify the target database, referenced tables and columns, and account permissions. |
Adoption fails | Inspect Last Error or the operation message. Check for name conflicts, missing objects, and insufficient permissions. |
An adopted view is missing from the list | Refresh the list. Verify the target database, view name, and account permissions. |
If the issue persists, retain the task and error details and contact technical support.