All Products
Search
Document Center

DataWorks:Publish a model

Last Updated:Oct 09, 2026

A logical model in DataWorks is a blueprint for data design. Publishing a model materializes the logical model as a physical table or view in an engine such as MaxCompute or Hologres for subsequent data development and analysis.

Limits

Before publishing a model, meet the following conditions:

  • Destination engine: You can publish to MaxCompute, EMR Hive, CDH Hive, Hologres, MySQL, StarRocks, DLF, and Lindorm engines.

  • Publication type:

    • When publishing as a view or materialized view, the destination engine supports only MaxCompute.

    • When publishing as a materialized view, the publication mode supports only Drop 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 destination engine is EMR Hive or CDH, you must specify an exclusive scheduling resource group or Serverless resource group to run the publication task.

Publish and materialize the model

You can publish and materialize dimension, fact, aggregate, and application tables directly to a created data source instance for subsequent development and analysis in a compute engine. Direct publication and materialization currently support MaxCompute, EMR Hive, CDH Hive, Hologres, MySQL, StarRocks, DLF, and Lindorm.

  1. Publish the model.

    After creating the model, click the Publish icon in the top toolbar of the table details page. In the Publish dialog box, configure the following key parameters. In the Publish dialog box, also configure Data source name by selecting a data source instance and Publication remarks by entering a description of this publication.

    Parameter

    Description

    Publish Type

    Specify how the model is materialized.

    • Physical table: Create a physical table in the destination engine.

    • View: Create a view in the destination engine. This option supports only the MaxCompute data source type.

    • materialized view: Create a materialized view in the destination engine. This option supports only the MaxCompute data source type. A materialized view precomputes and stores the results of time-consuming operations, such as JOIN and AGGREGATE, so queries can reuse them and run faster. For more information, see 物化视图操作.

    Data Source Type

    Select the engine used to store data. The following options are available: MaxCompute, EMR Hive, CDH Hive, Hologres, MySQL, StarRocks, DLF, and Lindorm.

    Effective Environment

    You can publish to Development or Production environment.

    • If your DataWorks workspace is in basic mode, you can publish tables only to the production environment.

    • If your DataWorks workspace is in standard mode, you can publish tables to the production or development environment.

    Publish Mode

    • Specify how changes to the model are published to the destination engine.

      • Incremental Publish: Update only changes to the current model in the destination engine. This mode is recommended for previously published models because it preserves historical data and reduces the impact on production workloads.

      • Delete and Recreate: Delete an existing model with the same name in the destination engine and then recreate it.Warning: This operation drops and recreates the table, causing historical data to be lost.

      The two modes have the same effect for the first publication.

    Automatic Rule Generation Based on Field Standard

    Specify whether to automatically generate quality rules after publishing the model. For more information, see Data labeling.

    • Yes: After successful publication to production, automatically generate quality rules for primary keys, non-null fields, and fields associated with standard codes.

    • No: Do not automatically generate quality rules.

    Resource Group

    When materializing a model table as a physical table in E-MapReduce or CDH, a resource group is required. Ensure that the selected resource group has network connectivity with the data source..

    Note
    • Publishing an E-MapReduce or CDH physical table supports only an exclusive scheduling resource group.

    • If you do not have a suitable exclusive scheduling resource group, see Use exclusive resource groups for scheduling to create one.

    DDL

    DataWorks automatically generates the SQL statement for publishing the configured model as a materialized view. Because publication succeeds only if the SELECT statement runs successfully, you must manually change the AS SELECT clause into executable SQL.

    Note
    • Configure this parameter only when publishing the model as a Materialized View.

    • For materialized view DDL operations, see 物化视图操作.

  2. After configuring the settings, click Publish. The system publishes the model to the corresponding Development or Production environment and materializes it in the selected engine.

    • You can view the current publication progress and logs in the Publish dialog box.

    • You can repeat the publication operation to publish the model to different environments.

  3. Optional:After publication, click the Logs icon in the top toolbar of the table details page to view the result and details of the latest publication.

    The Publishing Status field has Succeeded, Failed, Deploying three possible states.Succeeded logs are shown in the following figure.

    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, or municipality; 3 city; 4 district or county',
        country_id  STRING COMMENT 'Country ID',
        country_name STRING COMMENT 'Country name',
        province_id STRING COMMENT 'Province, autonomous region, or municipality ID',
        province_name STRING COMMENT 'Province, autonomous region, or municipality name',
        city_id     STRING COMMENT 'City ID',
        city_name   STRING COMMENT 'City name',
        district_id STRING COMMENT 'District or county ID',
        district_name STRING COMMENT 'District or 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 job
    Note
    • When Publishing Status is Failed, identify and resolve the cause promptly based on the specific error message.

    • When Publishing Logs dialog box displays No publishing logs found., the model has never been published.

  4. View publication history

    After a model is published, open its editor and click Publishing Record in the right navigation pane to view historical published versions. In the Publication History panel, you can view the publication history of model dim_ec_pub_region_df, including publication time, publisher, model version, and active environment. The current record shows that version V1 of the model was published to the development environment.

Generate an ETL code framework (model development)

In DataWorks Intelligent Data Modeling, you can use model development to generate an ETL code framework for published model tables, such as dimension and fact tables.

Note

Model development supports generating code only for model tables published to MaxCompute and EMR Hive compute engines.

  1. In DataWorks Intelligent Data Modeling, double-click a published model table to open its details page.

  2. Click Develop Model.

  3. In the Develop Model dialog box, select Create DataStudio Node or Associate DataStudio Node, configure the parameters, and click OK.

    1. Select Create DataStudio Node

      The system automatically creates a DataStudio node and fills its name from the table name. In the Model Development dialog box, configure the Destination workspace, Node type (such as ODPS SQL), and Node name.

      • If the model table was published to MaxCompute, an ODPS SQL node is created.

      • If the model table was published to EMR Hive, an EMR Hive node is created.

      After confirming the settings, click Go to DataStudio. A dialog box appears in Data Development to create the node. Click OK to create the node and generate ETL code.

    2. Select Associate DataStudio Node

      In the Model Development dialog box, configure Destination workspace, Node type (such as ODPS SQL), and Node name (ID) and click OK.

      to associate the code framework with an existing DataStudio node of the same engine type. After binding, click the node name to open the node page and continue development.

Note

To bind multiple nodes to the same model table, click Develop Model again.

Billing

Publishing a model is free of charge. Compute and storage resources consumed during materialization incur charges:

Destination engine costs: After materialization, the model uses storage and compute resources in the destination engine, such as MaxCompute or Hologres. Charges follow the relevant product's billing rules.