Skip to content

Commit 7eb6dbe

Browse files
authored
Revert "docs: document table branches in versioning guide (#275)" (#277)
This reverts commit ffd9b9a.
1 parent ffd9b9a commit 7eb6dbe

2 files changed

Lines changed: 0 additions & 59 deletions

File tree

docs/snippets/tables.mdx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ export const PyVersioningRollback = "table.restore(version_after_mod)\nversions
122122

123123
export const PyVersioningTags = "# Create a tag pointing at a specific version\ntable.tags.create(\"baseline\", 1)\ntable.tags.create(\"with-edits\", table.version)\n\n# List all tags on this table\nprint(table.tags.list())\n\n# Look up the version a tag points at\nprint(table.tags.get_version(\"baseline\"))\n\n# Move an existing tag to a different version\ntable.tags.update(\"baseline\", 2)\n\n# Check out a version by tag name\ntable.checkout(\"baseline\")\nprint(table.version)\n\n# Delete a tag (does not delete the underlying version)\ntable.tags.delete(\"with-edits\")\n\n# Return to the latest version\ntable.checkout_latest()\n";
124124

125-
export const PyVersioningBranches = "# Fork a new branch from the latest version of main\nexperiment = table.branches.create(\"experiment\")\nprint(experiment.current_branch()) # \"experiment\"\n\n# Writes on the branch handle do not affect main\nexperiment.add([{\"author\": \"Maya\", \"quote\": \"draft idea\"}])\n\n# List all branches on the table\nprint(table.branches.list())\n\n# Reopen an existing branch later (writable handle that tracks the branch tip)\nexperiment = table.branches.checkout(\"experiment\")\n\n# Pin a branch to a specific version (read-only view of that version)\nsnapshot = table.branches.checkout(\"experiment\", version=2)\n\n# Open a branch directly from the connection\nexperiment = db.open_table(\"my_table\", branch=\"experiment\")\n\n# Delete a branch when you're done with it\ntable.branches.delete(\"experiment\")\n";
126-
127125
export const PyVersioningUpdateData = "table.update(where=\"author='Richard'\", values={\"author\": \"Richard Daniel Sanchez\"})\nrows_after_update = table.count_rows(\"author = 'Richard Daniel Sanchez'\")\nprint(f\"Rows updated to Richard Daniel Sanchez: {rows_after_update}\")\n";
128126

129127
export const TsAddColumnsCalculated = "// Add a discounted price column (10% discount)\nawait schemaAddTable.addColumns([\n {\n name: \"discounted_price\",\n valueSql: \"cast((price * 0.9) as float)\",\n },\n]);\n";
@@ -220,8 +218,6 @@ export const TsVersioningRollback = "await table.checkout(versionAfterMod);\nawa
220218

221219
export const TsVersioningTags = "const tags = await tagsTable.tags();\n\n// Create a tag pointing at a specific version\nawait tags.create(\"baseline\", 1);\nawait tags.create(\"with-edits\", await tagsTable.version());\n\n// List all tags on this table\nconsole.log(await tags.list());\n\n// Look up the version a tag points at\nconsole.log(await tags.getVersion(\"baseline\"));\n\n// Move an existing tag to a different version\nawait tags.update(\"baseline\", 2);\n\n// Check out a version by tag name\nawait tagsTable.checkout(\"baseline\");\nconsole.log(await tagsTable.version());\n\n// Delete a tag (does not delete the underlying version)\nawait tags.delete(\"with-edits\");\n\n// Return to the latest version\nawait tagsTable.checkoutLatest();\n";
222220

223-
export const TsVersioningBranches = "const branches = await table.branches();\n\n// Fork a new branch from the latest version of main\nconst experiment = await branches.create(\"experiment\");\nconsole.log(experiment.currentBranch); // \"experiment\"\n\n// Writes on the branch handle do not affect main\nawait experiment.add([{ author: \"Maya\", quote: \"draft idea\" }]);\n\n// List all branches on the table\nconsole.log(await branches.list());\n\n// Reopen an existing branch later (writable handle that tracks the branch tip)\nconst tracking = await branches.checkout(\"experiment\");\n\n// Pin a branch to a specific version (read-only view of that version)\nconst snapshot = await branches.checkout(\"experiment\", 2);\n\n// Delete a branch when you're done with it\nawait branches.delete(\"experiment\");\n";
224-
225221
export const TsVersioningUpdateData = "await table.update({\n where: \"author = 'Richard'\",\n values: { author: \"Richard Daniel Sanchez\" },\n});\nconst rowsAfterUpdate = await table.countRows(\n \"author = 'Richard Daniel Sanchez'\",\n);\nconsole.log(`Rows updated to Richard Daniel Sanchez: ${rowsAfterUpdate}`);\n";
226222

227223
export const RsAddColumnsCalculated = "// Add a discounted price column (10% discount)\nschema_add_table\n .add_columns(\n NewColumnTransform::SqlExpressions(vec![(\n \"discounted_price\".to_string(),\n \"cast((price * 0.9) as float)\".to_string(),\n )]),\n None,\n )\n .await\n .unwrap();\n";
@@ -322,7 +318,5 @@ export const RsVersioningRollback = "table.checkout(version_after_mod).await.unw
322318

323319
export const RsVersioningTags = "let mut tags = tags_table.tags().await.unwrap();\n\n// Create a tag pointing at a specific version\ntags.create(\"baseline\", 1).await.unwrap();\nlet current_version = tags_table.version().await.unwrap();\ntags.create(\"with-edits\", current_version).await.unwrap();\n\n// List all tags on this table\nlet all_tags = tags.list().await.unwrap();\nprintln!(\"Tags: {:?}\", all_tags);\n\n// Look up the version a tag points at\nlet baseline_version = tags.get_version(\"baseline\").await.unwrap();\nprintln!(\"baseline -> v{}\", baseline_version);\n\n// Move an existing tag to a different version\ntags.update(\"baseline\", 2).await.unwrap();\n\n// Check out a version by tag name (separate method in Rust)\ntags_table.checkout_tag(\"baseline\").await.unwrap();\nprintln!(\"Current version: {}\", tags_table.version().await.unwrap());\n\n// Delete a tag (does not delete the underlying version)\ntags.delete(\"with-edits\").await.unwrap();\n\n// Return to the latest version\ntags_table.checkout_latest().await.unwrap();\n";
324320

325-
export const RsVersioningBranches = "// Fork a new branch from the latest version of main\nlet experiment = table.create_branch(\"experiment\", None, None).await.unwrap();\nprintln!(\"{:?}\", experiment.current_branch()); // Some(\"experiment\")\n\n// List all branches on the table\nlet all_branches = table.list_branches().await.unwrap();\nprintln!(\"Branches: {:?}\", all_branches);\n\n// Reopen an existing branch later (writable handle that tracks the branch tip)\nlet tracking = table.checkout_branch(\"experiment\", None).await.unwrap();\n\n// Pin a branch to a specific version (read-only view of that version)\nlet snapshot = table.checkout_branch(\"experiment\", Some(2)).await.unwrap();\n\n// Delete a branch when you're done with it\ntable.delete_branch(\"experiment\").await.unwrap();\n";
326-
327321
export const RsVersioningUpdateData = "table\n .update()\n .only_if(\"author = 'Richard'\")\n .column(\"author\", \"'Richard Daniel Sanchez'\")\n .execute()\n .await\n .unwrap();\nlet rows_after_update = table\n .count_rows(Some(\"author = 'Richard Daniel Sanchez'\".to_string()))\n .await\n .unwrap();\nprintln!(\n \"Rows updated to Richard Daniel Sanchez: {}\",\n rows_after_update\n);\n";
328322

docs/tables/versioning.mdx

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ import {
3535
PyVersioningTags as VersioningTags,
3636
TsVersioningTags as TsVersioningTags,
3737
RsVersioningTags as RsVersioningTags,
38-
PyVersioningBranches as VersioningBranches,
39-
TsVersioningBranches as TsVersioningBranches,
40-
RsVersioningBranches as RsVersioningBranches,
4138
RsVersioningMakeQuotesReader as RsVersioningMakeQuotesReader,
4239
} from '/snippets/tables.mdx';
4340

@@ -221,56 +218,6 @@ Deleting a tag only removes the label, not the version it points to. After
221218
deletion, the underlying table version becomes eligible for cleanup again.
222219
</Note>
223220

224-
## Branches
225-
226-
Branches are isolated, writable lines of history forked from another branch
227-
(or a specific version of one). Use them when you need to experiment with
228-
schema or data changes, run an A/B compaction strategy, or stage a backfill
229-
without affecting readers on `main`. Conceptually they sit next to tags:
230-
**tags label a single version**, while **branches let history diverge** from
231-
that point.
232-
233-
The branch manager supports the standard operations — `create`, `list`,
234-
`checkout`, `delete` — and `checkout` / `create` return a new table handle
235-
scoped to the branch. Writes on that handle do not touch `main`. The
236-
original handle keeps pointing at the branch it was opened on, which is
237-
reported by `current_branch()` (`null` / `None` for `main`).
238-
239-
<CodeGroup>
240-
<CodeBlock filename="Python" language="Python" icon="python">
241-
{VersioningBranches}
242-
</CodeBlock>
243-
244-
<CodeBlock filename="TypeScript" language="TypeScript" icon="square-js">
245-
{TsVersioningBranches}
246-
</CodeBlock>
247-
248-
<CodeBlock filename="Rust" language="Rust" icon="rust">
249-
{RsVersioningBranches}
250-
</CodeBlock>
251-
</CodeGroup>
252-
253-
In Python, you can also open a branch directly from the connection by
254-
passing `branch=` to `open_table()`. Combine it with `version=` to open a
255-
read-only handle pinned to a specific version on that branch:
256-
257-
```python
258-
# Latest version of the experiment branch (writable)
259-
experiment = db.open_table("my_table", branch="experiment")
260-
261-
# Pinned to v3 of the experiment branch (read-only)
262-
snapshot = db.open_table("my_table", branch="experiment", version=3)
263-
```
264-
265-
<Note>
266-
Each branch handle has its own freshness state and version pin, so reopening
267-
a branch on a new connection — or restoring one from a pickled handle —
268-
keeps you on the branch instead of silently reverting to `main`.
269-
270-
Branches are supported by tables backed by the Lance format directly and by
271-
remote tables served by LanceDB Enterprise.
272-
</Note>
273-
274221
## Delete Data From the Table
275222

276223
Let's demonstrate how deletions also create new versions:

0 commit comments

Comments
 (0)