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:
Jack Ye
2026-11-14 10:48:26 +08:00
committed by GitHub
parent a0eb6b4b71
commit 4db0d5c7f5
11 changed files with 162 additions and 30 deletions
+10
View File
@@ -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