Skip to main content

MERGE BRANCH

Merge a branch in an Arctic catalog.

To run MERGE BRANCH, users need the USAGE and COMMIT privileges on the Arctic catalog. In the following cases, users need additional privileges:

  • If a table on the source branch was updated, whether inserted or altered, users also need the WRITE privilege on the catalog, any parent folder for the table, or the table itself.
  • If a table on the source branch was deleted, users also need the OWNERSHIP privilege on the catalog, any parent folder for the table, or the table itself.
  • If a folder was created on the source branch and does not exist in the target branch, users also need the CREATE FOLDER privilege on the catalog or any parent folder for the folder.
  • If a table was created on the source branch and does not exist in the target branch, users also need the CREATE TABLE privilege on the catalog or any parent folder for the table.
  • If a view was created on the source branch and does not exist in the target branch, users also need the CREATE VIEW privilege on the catalog or any parent folder for the 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