All Products
Search
Document Center

Dataphin:Quickly import SQL using API SQL scripts

Last Updated:Nov 18, 2025

This topic describes the SQL script statements that you can use to quickly import SQL.

GET/LIST (Query type)

  • The SELECT statement returns all fields by default.

  • If the data source is a MaxCompute partitioned table, the system adds a WHERE clause by default and uses the partition field as the condition.

select col1, col2, col3,…,coln from tablename
select col1, col2, col3,…,coln from tablename where ds=${ds}

Create (Operation type)

insert into tablename (col1, col2, col3,… coln) values(${col1}, ${col2}, ${col3},…,${coln}

Update (Operation type)

  • By default, the WHERE clause includes an equivalent condition for each primary key field. The SET clause includes all fields except for the primary key fields.

  • If no primary key exists, the placeholder keycolumn=${keycolumn} is retained. You must modify the WHERE clause.

UPDATE table_name
SET 
    column1 = ${column1},
    column2 =  ${column2},
    column3 =  ${column3}
WHERE keycolumn1=${keycolumn1} and keycolumn2=${keycolumn2}

Delete (Operation type)

By default, the WHERE clause includes an equivalent condition for each primary key field. If no primary key exists, the placeholder keycolumn=${keycolumn} is retained. You must modify the WHERE clause.

DELETE FROM table_name 
WHERE keycolumn1=${keycolumn1} and keycolumn2=${keycolumn2}