All Products
Document Center


Last Updated: Jun 01, 2020

SQL scripts

You can use the SQL script editor to write SQL syntaxes. For more information, see MaxCompute SQL Introduction.


  1. Drag a MaxCompute source component to the canvas and enter the table name in the right pane, as shown in the following figure.


    • A SQL Script component supports a maximum of four input ports.

    • If a partitioned table is input, the system automatically selects the Partition option for the table. You can then select a partition or enter a partition name. Currently, only one partition can be specified. If the Partition option is not selected or no partition name is specified, the system determines that a full table is input.

    • The Partition option is unavailable when an unpartitioned table is input.

  2. Drag a SQL script component to the canvas, connect the component to the MaxCompute source component, and click the SQL Script component. The parameters appear, as shown in the following figure.
    Enter SQL syntaxes, as shown in the following figure:

    • A SQL Script Component supports a maximum of two input ports and one output port.

    • You can enter only one SQL syntax, for details see SQL Expressions.

    • Input tables are mapped to t1 and t2, respectively. You can use ${t1} or ${t2} to make a call to the relevant table without a need to specify the table name.

    • The SQL script in the preceding figure is used to calculate the number of rows in the table.

  3. Drag a MaxCompute target component to the Canvas and enter a new table name, as shown in the following figure. The system then automatically creates the table. If you want to input a partitioned table, you must enter partition information.
    Currently, partitioned tables are not supported.

  4. Connect all components and then click Run.

  5. Right-click the MaxCompute target component and select View Data.

PAI commands

No PAI commands are available.