Manage notebook cells

更新时间: 2026-05-22 06:02:53

A notebook cell is the basic component for building content in a notebook. By adding cells to a notebook, you can create and organize your content. Different types of cells support different operations and features. This topic describes the use cases for each cell type and how to manage them.

Background information

For details about the Markdown syntax supported in Markdown cells, see https://www.markdownguide.org/extended-syntax/ and https://www.markdownguide.org/basic-syntax/.

The following syntax is not yet supported:

  • HTML

  • Definition Lists

  • Emoji

  • Highlight

  • Subscript

  • Superscript

Markdown cell

A Markdown cell allows you to add text content to your notebook by using standard Markdown syntax.

image

Area

Description

action bar

After you select a Markdown cell, you can manage it from the action bar. The available operations include switching the cell type, adding a cell below the current one, copying the cell, moving the cell up or down, and deleting the cell.

  • Switch cell: Change the cell type to Markdown, SQL, or database SQL.

  • Add cell: Add a new Markdown, SQL, or database SQL cell below the current one.

  • Copy cell: Create a copy of the current cell below it.

  • Move cell: Move the current cell up or down.

  • Delete cell: Delete the current cell.

editing area

In the editing area, you can write content for your notebook by using Markdown syntax. For more information, see Markdown syntax.

SQL cell

An SQL cell allows you to add and run SQL code for a compute engine in your notebook.

image

Area

Description

action bar

After you select an SQL cell, you can manage it from the action bar. The available operations include running SQL code, enabling Query Acceleration, collapsing the cell, formatting SQL, switching the cell type, adding a cell, copying the cell, moving the cell, and deleting the cell.

  • Run: Runs the SQL code in the cell.

  • Query Acceleration: Supported for MAXCOMPUTE_SQL cells. After you enable Query Acceleration, you must select an acceleration method.

    • Acceleration source: Use an acceleration source to accelerate queries. If you select this method, you must also select an acceleration source and a resource group.

      • Acceleration source: Select an acceleration source that is bound to the compute source of the current project. If no acceleration source is available, click Create Acceleration Source to go to the Create Acceleration Source page and create one as needed.

      • Resource group (optional): Select a configured resource group under the selected acceleration source.

      Note
      • If you use an acceleration source, the ad hoc query runs based on the syntax of the selected acceleration source type. Make sure that your SQL statements comply with the syntax specifications. For example, if the acceleration source type is StarRocks, the ad hoc query runs based on the StarRocks syntax.

      • Using an acceleration source for queries does not create a temporary table for each query.

    • MCQA: Short for MaxCompute Query Acceleration. Each tenant has limits on the number of jobs and concurrent queries, which can cause acceleration failures or execution errors. For more information, see Query Acceleration (MCQA). You can disable MCQA acceleration in Management Center > System Settings > DataStudio > Query Acceleration.

    The available acceleration methods depend on the compute engine and scenario.

    If the current tenant uses a MaxCompute compute engine:

    • If you have not purchased Query Acceleration but have enabled Query Acceleration in DataStudio, the acceleration method is MCQA.

    • If you have purchased Query Acceleration, enabled Query Acceleration in DataStudio, and the current project's compute source is not bound to an acceleration source, the acceleration method is MCQA.

    • If you have purchased Query Acceleration and the project's compute source is bound to an acceleration source, you can select either an acceleration source or MCQA as the acceleration method.

  • Collapse cell: Collapse the cell's code area.

  • Format SQL: Format the SQL code in the cell.

  • Switch cell: Switch the current SQL cell to another type, such as a Markdown cell, SQL cell, or database SQL cell.

  • Add cell: Add another cell below the current SQL cell, such as a Markdown cell, SQL cell, or database SQL cell.

  • Copy cell: Create a copy of the current SQL cell below it.

  • Move cell: Move the current SQL cell up or down.

  • Delete cell: Delete the current SQL cell.

editing area

You can write SQL code for the compute engine in the editing area.

Database SQL cell

A database SQL cell allows you to add and run database SQL code in your notebook.

image

Area

Description

action bar

After you select a database SQL cell, you can manage it from the action bar. The available operations include running database SQL code, collapsing the cell, formatting SQL, switching the cell type, adding a cell, copying the cell, moving the cell, and deleting the cell.

  • Run: Run the SQL code in the current database SQL cell.

    Note

    By default, running a database SQL cell uses the default resource group configured in the selected data source, not the default resource group of the analysis project.

  • Collapse cell: Collapse the code area of the current database SQL cell.

  • Format SQL: Format the SQL code in the current database SQL cell.

  • Switch cell: Switch the current database SQL cell to another type, such as a Markdown cell, SQL cell, or database SQL cell.

  • Add cell: Add another cell below the current database SQL cell, such as a Markdown cell, SQL cell, or database SQL cell. For a list of data source types supported by database SQL cells, see .

  • Copy cell: Create a copy of the current database SQL cell below it.

  • Move cell: Move the current database SQL cell up or down.

  • Delete cell: Delete the current database SQL cell.

  • Select data source: Select a data source (including external data sources) to use for executing the SQL code.

  • catalog: You must select a catalog for Presto and Trino data sources.

  • database/schema: You must select a database or schema for the following data source types: MySQL, PostgreSQL, Hologres, AnalyticDB for PostgreSQL, OceanBase (Oracle tenant mode), Lindorm, Oracle, ClickHouse, DM, openGauss, StarRocks, Doris, SelectDB, Presto, GaussDB (DWS), Trino, PolarDB-X 2.0, and OushuDB.

editing area

You can write database SQL code in the editing area.

After you finish editing the database SQL code and click Run, the system parses the code to verify the current user's permissions for all objects. If the permission check fails, a dialog box appears listing the objects for which you lack permissions.

The permission check failure dialog box displays the object name, object type, permission type, and available operations.

  • Object Name: The name of the object for which you lack permission.

  • Object Type: Table or global variable.

  • Permission Type: The permission required to run the script. For example, tables require data query permission, while data sources require execute permission.

  • Operation: Provides options to apply for permissions for one or more objects that failed the permission check.

    • To apply for permissions on a single object: Click the image.png icon in the Operation column for the target object to apply for personal permissions on it. The default validity period is 30 days.

    • To apply for permissions on multiple objects: Select multiple objects, or select Select All Tables and then click Apply for Permissions.

    For detailed instructions on how to apply for permissions, see Apply for permissions. After the permissions are granted, you can run the code again.

    Note

    Only MySQL and Oracle data sources support table-level permission control.

上一篇: Create a new notebook 下一篇: Create manual tables based on the analysis platform
阿里云首页 智能数据建设与治理 Dataphin 相关技术圈