From 28c89430e942b241af22bf7319a3075bd4a08b3d Mon Sep 17 00:00:00 2001 From: Wing Yew Poon Date: Wed, 6 Dec 2023 21:14:59 -0800 Subject: [PATCH] Docs: Document reading in Spark using branch and tag identifiers --- docs/spark-queries.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/spark-queries.md b/docs/spark-queries.md index 54b1ee6bd120..38d989f003f6 100644 --- a/docs/spark-queries.md +++ b/docs/spark-queries.md @@ -120,6 +120,17 @@ SELECT * FROM prod.db.table TIMESTAMP AS OF 499162860; SELECT * FROM prod.db.table FOR SYSTEM_TIME AS OF 499162860; ``` +The branch or tag may also be specified using a similar syntax to metadata tables, with `branch_` or `tag_`: + +```sql +SELECT * FROM prod.db.table.`branch_audit-branch`; +SELECT * FROM prod.db.table.`tag_historical-snapshot`; +``` + +(Identifiers with "-" are not valid, and so must be escaped using back quotes.) + +Note that the identifier with branch or tag may not be used in combination with `VERSION AS OF`. + #### DataFrame To select a specific table snapshot or the snapshot at some time in the DataFrame API, Iceberg supports four Spark read options: