In DataWorks, a logical model is a blueprint for your data design. Publishing a model materializes it as a physical table or view in a compute engine, such as MaxCompute or Hologres, for data development and analysis.
Limitations
Before you publish a model, ensure that the following conditions are met:
-
Compute engine: You can publish models to MaxCompute, Hologres, EMR Hive, CDH, and MySQL.
-
Publish Type:
-
You can publish a model as a view or materialized view only to the MaxCompute compute engine.
-
The only supported Publish Mode for a materialized view is Delete and Recreate.
-
-
Environment:
-
In a basic-mode workspace, you can publish only to the production environment.
-
In a standard-mode workspace, you can publish to the development or production environment.
-
-
Resource group:
-
When the compute engine is EMR Hive or CDH, you must specify an exclusive resource group for scheduling or a Serverless resource group to run the publish task.
-
Publish and materialize a model
You can publish and materialize dimension tables, fact tables, aggregate tables, and application tables directly into a data source instance, making them available to compute engines for data development and analysis.
-
Publish the model.
After the model is created, click the
icon in the top menu bar on the table details page. In the Publish dialog box that appears, configure the parameters in the following table. You must also specify a Data Source Name (a specific data source instance) and provide Publish Remarks (a description of the operation).Parameter
Description
Publish Type
The form in which the model is materialized.
-
Physical Table: Creates a physical table in the compute engine.
-
View: Creates a view in the compute engine. This option is available only for MaxCompute data sources.
-
Materialized View: Creates a materialized view in the compute engine. This option is available only for MaxCompute data sources. A materialized view is a form of precomputation. It stores the results of time-consuming operations like JOIN and AGGREGATE, which avoids repeating expensive calculations and accelerates queries. For more information, see Materialized view operations.
Data Source Type
The compute engine that is used to store data. Valid values: MaxCompute, EMR Hive, Hologres, CDH, and MySQL.
Effective Environment
Specifies whether to publish to the Development or Production environment.
-
If you use a basic-mode workspace, you can publish the table only to the production environment.
-
If you use a standard-mode workspace, you can publish the table to the production or development environment.
Publish Mode
-
The method for publishing the model to the compute engine.
-
Incremental Publish: Updates the compute engine with only the changes that are made to the current model. This mode is recommended for existing models to preserve historical data and minimize the impact on online services.
-
Delete and Recreate: Deletes the existing table in the compute engine and then creates a new one. Note: This action deletes the table and all its data before recreating it.
For the initial publish, both modes produce the same result.
-
Automatic Rule Generation Based on Field Standard
Specifies whether to automatically generate data quality rules after the model is published. For more information, see Data Labeling.
-
Yes: After the model is successfully published to the production environment, quality rules are automatically generated for fields that are primary keys, non-null, or associated with standard codes.
-
No: Quality rules are not automatically generated.
Resource Group
This parameter is required when you materialize a model as a physical table in EMR Hive or CDH. Ensure that network connectivity is established between the selected resource group and the data source.
Note-
To publish a physical table to EMR Hive or CDH, you can only use an exclusive resource group for scheduling.
-
If you do not have a suitable exclusive resource group for scheduling, you can create one. For more information, see Use exclusive resource groups for scheduling.
DDL
DataWorks automatically generates the SQL statement to create a materialized view based on your model configuration. Because the publish operation succeeds only if the SELECT statement is valid, you must manually modify the
AS SELECTclause to ensure it is an executable SQL statement.Note-
This parameter is required only when you set Materialized View to Materialized View.
-
For more information about DDL operations for materialized views, see Materialized view operations.
-
-
After you configure the parameters, click Publish. The system publishes the model to the selected Development or Production environment and materializes it in the chosen compute engine.
-
You can view the current publishing progress and related logs in the Publish dialog box.
-
You can repeat the publish operation to deploy the model to different environments.
-
-
Optional: After publishing is complete, you can click the
icon in the top menu bar of the table details page to view the results and details of the latest publish operation.The Publishing Status can be Succeeded, Failed, or Deploying. The following log shows an example of a Succeeded publish operation.
2025-12-22 13:56:44 INFO – success to submit task to execute script, requestId is 480ead48371568e2ad85dc6ce3b68e60, taskCode is xxx 2025-12-22 13:56:47 INFO – success to execute script: CREATE TABLE IF NOT EXISTS own_yunwan.dim_ec_pub_region_df ( id STRING COMMENT 'Administrative region ID', name STRING COMMENT 'Administrative region name', level INT COMMENT 'Administrative region level. 1: Country, 2: Province/Autonomous region/Municipality, 3: City, 4: District/County', country_id STRING COMMENT 'Country ID', country_name STRING COMMENT 'Country name', province_id STRING COMMENT 'Province/Autonomous region/Municipality ID', province_name STRING COMMENT 'Province/Autonomous region/Municipality name', city_id STRING COMMENT 'City ID', city_name STRING COMMENT 'City name', district_id STRING COMMENT 'District/County ID', district_name STRING COMMENT 'District/County name', ds STRING COMMENT 'Business date, yyyymmdd' ) COMMENT 'Geographic administrative region dimension table' LIFECYCLE 1000 2025-12-22 13:56:47 INFO – finish and success to execute all script 2025-12-22 13:56:50 INFO – end and success to deploy jobNote-
If the Publishing Status is Failed, identify and resolve the issue based on the provided error message.
-
If the Publishing Logs dialog box displays No publishing logs found., the model has never been published.
-
-
View the publishing record
After the model is published successfully, go to the model's edit page and click Publishing Record in the right-side navigation pane to view its publish history. In the Publishing Record panel, you can view the publish history for the
dim_ec_pub_region_dfmodel. The history includes columns for the publish time, publisher, model version, and effective environment. The current record shows that version V1 of the model has been published to the development environment.
Model development
In DataWorks Data Modeling, you can use the Model Development feature to generate an Extract, Transform, and Load (ETL) code framework for published model tables, such as dimension tables and fact tables.
The Model Development feature supports code generation only for model tables that are published to the MaxCompute or EMR Hive compute engines.
-
In DataWorks Data Modeling, double-click a published model table to open its details page.
-
In the actions bar, click Develop Model.
-
In the Develop Model dialog box, select either Create DataStudio Node or Associate DataStudio Node, configure the parameters, and then click OK.
-
Select Create DataStudio Node
The system automatically creates a DataStudio node and populates the node name based on the table name. In the Model Development dialog box, configure parameters such as Destination Workspace, Node Type (for example, ODPS SQL), and Node Name.
-
If the model table is published to the MaxCompute engine, an ODPS SQL node is created.
-
If the model table is published to the EMR Hive engine, an EMR Hive node is created.
After you confirm the configuration, click Go to DataStudio. In DataStudio, a dialog box to create the node appears. Click OK to create the node and generate the ETL code.
-
-
Select Associate DataStudio Node
In the Model Development dialog box, configure the Destination Workspace, Node Type (for example, ODPS SQL), and Node Name(ID), and then click OK.
This associates the code framework with an existing DataStudio node of the same engine type. Once the binding is successful, you can click the node name to go to the corresponding node page and continue development.
-
If you need to associate multiple nodes with the same model table, click Develop Model again to bind another node.
Billing
The model publishing feature is free of charge. However, you are charged for the computing and storage resources consumed during materialization:
Compute engine fees: After a model is materialized, the compute engine (such as MaxCompute and Hologres) charges you for storage and computing resources based on the product's billing rules.