mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-18 00:24:01 +00:00
feat(python): support exist_ok when cloning tables (#4990)
Adds `exist_ok=False` to Python table cloning and `.exist_ok(true)` to
the Rust clone builder. An existing target is returned with its data and
version history unchanged; strict duplicate errors remain the default.
```python
snapshot = db.clone_table("snapshot", source_uri, exist_ok=True)
```
Embedded cloning skips source reads for an existing target and handles
typed creation conflicts. Remote cloning forwards the option to the
server. Includes sync/async preservation and remote request coverage,
plus SQL syntax documentation for `CREATE TABLE IF NOT EXISTS target
CLONE source`. Requires a server supporting the option for remote
clones.
BREAKING CHANGE: Rust `CloneTableRequest` struct literals must
initialize the new `exist_ok` field; `CloneTableRequest::new` remains
compatible.
No local builds or tests were run, as requested.
This commit is contained in:
@@ -205,6 +205,16 @@ Dropping, renaming, or retyping a column is an SDK operation
|
||||
|
||||
## CLONE {#clone}
|
||||
|
||||
{/* Draft for the table-clone exist_ok release.
|
||||
|
||||
Use `CREATE TABLE IF NOT EXISTS target CLONE source` to preserve an existing
|
||||
target unchanged. The Python equivalent is
|
||||
`db.clone_table("target", source_uri, exist_ok=True)`. Omitting the option reports
|
||||
an error for an existing target. A skipped clone does not copy rows or change
|
||||
the target's version history.
|
||||
|
||||
*/}
|
||||
|
||||
<CodeGroup>
|
||||
```sql SQL icon="database"
|
||||
CREATE TABLE docs_snapshot CLONE documents
|
||||
|
||||
Reference in New Issue
Block a user