CREATE TAG¶
Create a named tag for a Lance table.
Spark Extension Required
This feature requires the Lance Spark SQL extension to be enabled. See Spark SQL Extensions for configuration details.
Overview¶
The CREATE TAG command creates a stable named reference to a specific table state. A tag can be created from:
- the latest version of
main - a specific version on
main - the head of another branch
- a specific version on another branch
- another tag
Syntax¶
ALTER TABLE <table> CREATE TAG [IF NOT EXISTS] <tag_name>;
ALTER TABLE <table> CREATE TAG [IF NOT EXISTS] <tag_name>
AS OF VERSION <version>;
ALTER TABLE <table> CREATE TAG [IF NOT EXISTS] <tag_name>
AS OF BRANCH <source_branch>;
ALTER TABLE <table> CREATE TAG [IF NOT EXISTS] <tag_name>
AS OF BRANCH <source_branch> VERSION <version>;
ALTER TABLE <table> CREATE TAG [IF NOT EXISTS] <tag_name>
AS OF TAG <source_tag>;
If the AS OF clause is omitted, the tag is created from the latest version of main.
Examples¶
Create a tag from the latest main¶
Create a tag from a specific main version¶
Create a tag from another branch head¶
Create a tag from a specific version on another branch¶
Create a tag from another tag¶
Output¶
The CREATE TAG command returns:
| Column | Type | Description |
|---|---|---|
name |
String | The name of the new tag |
Notes and Limitations¶
CREATE TAGis implemented as a Spark SQL extension command.- The referenced table must be a Lance table.
- Creating a tag from a non-existent branch, tag, or version returns an error.