Tags and Branches
Create and manage named versions and branches.
See Procedures for Flink version requirements, argument conventions, and catalog selection.
create_tag
To create a tag based on given snapshot. Arguments:
-
table: the target table identifier. Cannot be empty. -
tagName: name of the new tag. -
snapshotId (Long): id of the snapshot which the new tag is based on.
-
time_retained: The maximum time retained for newly created tags.
Syntax
-- Use named argument
-- based on the specified snapshot
CALL [catalog.]sys.create_tag(`table` => 'identifier', tag => 'tagName', snapshot_id => snapshotId);
-- based on the latest snapshot
CALL [catalog.]sys.create_tag(`table` => 'identifier', tag => 'tagName');
-- Use indexed argument
-- based on the specified snapshot
CALL [catalog.]sys.create_tag('identifier', 'tagName', snapshotId);
-- based on the latest snapshot
CALL [catalog.]sys.create_tag('identifier', 'tagName');
Example
CALL sys.create_tag(
`table` => 'default.T',
tag => 'my_tag',
snapshot_id => cast(10 as bigint),
time_retained => '1 d'
);
create_tag_from_timestamp
To create a tag based on given timestamp. Arguments:
-
table: the target table identifier. Cannot be empty. -
tag: name of the new tag. -
timestamp (Long): Find the first snapshot whose commit-time greater than this timestamp.
-
time_retained: The maximum time retained for newly created tags.
Syntax
-- Create a tag from the first snapshot whose commit-time greater than the specified timestamp.
-- Use named argument
CALL [catalog.]sys.create_tag_from_timestamp(
`table` => 'identifier',
tag => 'tagName',
timestamp => timestamp,
time_retained => time_retained
);
-- Use indexed argument
CALL [catalog.]sys.create_tag_from_timestamp('identifier', 'tagName', timestamp, time_retained);
Example
-- for Flink 1.18
CALL sys.create_tag_from_timestamp('default.T', 'my_tag', 1724404318750, '1 d');
-- for Flink 1.19 and later
CALL sys.create_tag_from_timestamp(
`table` => 'default.T',
`tag` => 'my_tag',
`timestamp` => 1724404318750,
time_retained => '1 d'
);