feat(remote): support set_unenforced_primary_key

`RemoteTable::set_unenforced_primary_key` returned `NotSupported`, so the
call failed against LanceDB Cloud and enterprise from every SDK -- Python
and TypeScript both forward to it. That also blocked sharded LSM writes,
since the server rejects bucket/identity sharding on a table that declares
no unenforced primary key.

No server-side support was missing. The unenforced primary key is Lance
schema field metadata, and the existing `update_field_metadata` endpoint
writes exactly that, so the remote table now installs the key through it.
The commit layer behind that endpoint installs the position, enforces
immutability and runs `verify_primary_key()` -- the same code a native
table reaches, so both paths agree on semantics and not just on messages.

The request validation and the metadata edit move into shared helpers so
the native and remote paths cannot drift. Native behaviour is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011xV8EebEZDmDDV8hVBm6MD
This commit is contained in:
Daniel Rammer
2026-09-10 10:41:26 -05:00
co-authored by Claude Opus 5
parent bc4497b21a
commit f9dab6c3c8
4 changed files with 214 additions and 51 deletions
+1 -1
View File
@@ -1008,7 +1008,7 @@ class RemoteTable(Table):
return LOOP.run(self._table.drop_columns(columns))
def set_unenforced_primary_key(self, columns: Union[str, Iterable[str]]) -> None:
"""Not supported on LanceDB Cloud."""
"""Set the unenforced primary key for this table to a single column."""
return LOOP.run(self._table.set_unenforced_primary_key(columns))
def set_lsm_write_spec(self, spec: "LsmWriteSpec") -> None: