Skip to main content

MERGE BRANCH

Merge a (source) branch into the current branch that you are in by default, or into a target branch that you specify.

To run MERGE BRANCH, users need the USAGE and COMMIT privileges on the Arctic catalog. If the source branch contains updated or deleted tables, users need additional privileges:

  • If a table or view on the source branch was updated, whether inserted or altered, users also need the WRITE privilege on the the table or view.
  • If a table or view on the source branch was deleted, users also need the OWNERSHIP privilege on the table or view.
Syntax
MERGE BRANCH <source_branch_name>
[ INTO <target_branch_name> ]
[ IN <catalog_name> ]

Parameters

<source_branch_name> String

The name of the branch that you want to merge into your target branch. If a target branch is not specified, the source branch is merged into the current branch you are in.


INTO <target_branch_name> String   Optional

The name of the branch that is the target for the merge. If you do not use this optional clause and the reference is a branch, the query will still run successfully. However, if the reference is not a branch, the query will fail because you can merge only branches.


IN <catalog_name> String   Optional

The name of the Arctic catalog. If not specified, the current Arctic catalog in the query context is used.

Examples

Merge a branch you specify into the current reference branch
MERGE BRANCH myBranch
Merge a branch you specify into another branch in the specified catalog
MERGE BRANCH myBranch
INTO main
IN myCatalog