Skip to content

[CXH-2723] - Add Unity Catalog table and volume sync - Databricks Connector - #73

Draft
mateoHernandez123 wants to merge 74 commits into
mateoHernandez123/unity-catalog-schema-syncfrom
mateoHernandez123/unity-catalog-table-and-volume-sync
Draft

mateoHernandez123 wants to merge 74 commits into
mateoHernandez123/unity-catalog-schema-syncfrom
mateoHernandez123/unity-catalog-table-and-volume-sync

Conversation

@mateoHernandez123

@mateoHernandez123 mateoHernandez123 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Description

  • Bug fix
  • New feature

Last of four stacked PRs for Unity Catalog (CXH-2723). Adds the table and volume resources: sync, entitlements, grants, and Grant/Revoke of their privileges. No new config field, no credential change.

Merge #71 and #72 first. This PR branches from #72, so GitHub moves the base down the stack as each parent lands.

What this adds

schema was a leaf. Tables and volumes now hang from it, each opt-in, keyed {metastore_id}::{catalog}.{schema}.{name}, with a read-only owner entitlement. These are the data assets an access review is about; every level before this one is a container that leads to them.

flowchart TD
  account[account] --> other["user, group, service principal, role, workspace"]
  account --> metastore[metastore]
  metastore --> catalog[catalog]
  catalog --> schema[schema]
  schema --> table[table]
  schema --> volume[volume]
  style table fill:#1f6feb,color:#fff,stroke:#1f6feb
  style volume fill:#1f6feb,color:#fff,stroke:#1f6feb
Loading

A principal can hold USE_SCHEMA and hold nothing on the tables under it, which is why each one is its own resource.

One table securable, several kinds of table

Unity Catalog uses one table securable for tables, views, materialized views, metric views and streaming tables. The grants API accepts a different set for each, so entitlements are built per instance from table_type rather than declared once. A privilege the API refuses is still reported when a principal already holds it; it is just not requestable, and Grant rejects it before any PATCH.

flowchart TD
  table[table_type] --> managed["MANAGED, EXTERNAL,<br/>shallow clones"]
  table --> view["VIEW, METRIC_VIEW"]
  table --> mv[MATERIALIZED_VIEW]
  table --> st[STREAMING_TABLE]
  table --> foreign[FOREIGN]
  table --> empty[missing or unrecognised]
  managed --> tpriv["the table set"]
  view --> vpriv["the view set;<br/>ALL_PRIVILEGES is report-only"]
  mv --> mvpriv["the view set + REFRESH,<br/>requestable"]
  st --> stpriv["SELECT, READ_METADATA, APPLY_TAG,<br/>MANAGE, ALL_PRIVILEGES, REFRESH;<br/>MODIFY is report-only"]
  foreign --> fpriv["read-only: no DELETE,<br/>INSERT, UPDATE or MODIFY"]
  empty --> anypriv["the union, so a held REFRESH<br/>is not dropped; it is report-only"]
Loading

A volume's set is static — ALL_PRIVILEGES, APPLY_TAG, MANAGE, READ_METADATA, READ_VOLUME, WRITE_VOLUME — so volume skips per-instance entitlements and table does not.

Who may list them, and who may read their privileges

Two different rights again, and this time they do not line up with the schema's. USE_SCHEMA and ALL_PRIVILEGES on the catalog each make the schema listing complete; only ALL_PRIVILEGES makes the table and volume listing complete. Databricks answers a caller that may not see everything with HTTP 200 and a short list, so each needs its own proof.

flowchart TD
  q["What may the service principal do on this schema?"] --> own{"owns the metastore,<br/>the catalog or the schema?"}
  own -->|yes| both["lists every table and volume<br/>and reads every privilege"]
  own -->|no| grp{"catalog owner is _workspace_admins_&lt;ws&gt;_&lt;id&gt;<br/>and a <b>direct</b> Admin there?"}
  grp -->|yes| both
  grp -->|no| all{"holds ALL_PRIVILEGES<br/>on the catalog?"}
  all -->|yes| listonly["lists every table and volume;<br/>Grants still needs MANAGE"]
  all -->|no| man{"holds MANAGE or USE_SCHEMA<br/>on the schema or the catalog?"}
  man -->|yes| schemaonly["the schemas sync;<br/>their children refuse with PermissionDenied"]
  man -->|no| deny["PermissionDenied naming the schema<br/>and the remedy — C1 removes nothing"]
  style both fill:#238636,color:#fff,stroke:#238636
  style listonly fill:#9e6a03,color:#fff,stroke:#9e6a03
  style schemaonly fill:#9e6a03,color:#fff,stroke:#9e6a03
  style deny fill:#da3633,color:#fff,stroke:#da3633
Loading

The amber branches are real setups, not corner cases: ALL_PRIVILEGES leaves MANAGE out, and USE_SCHEMA is the privilege an operator reaches for first. The setup docs now say what each level needs.

What the sync does in each case

The rule throughout: nothing is removed on an answer the connector could not prove.

Situation Connector Effect in C1
A workspace serves the catalog and the schema and proves the listing complete emits the tables and volumes synced
The first workspace refuses the catalog or the schema read (401, 403, 404) walks on to the next one in scope synced through the one that can
No workspace can prove it PermissionDenied naming the schema nothing removed
Every workspace answers the catalog is gone, none refusing emits nothing removed with the parent
A workspace serves the catalog after an earlier one called it gone the later sighting wins synced
A bare 404 on the children listing FailedPrecondition nothing removed
A privilege list that is not provably complete PermissionDenied nothing removed
A 404 naming the table itself emits no grants removed
A 404 naming a parent, or the generic one, with the parent served emits no grants removed
The same 404 where the parent does not answer refuses the read nothing removed
information_schema always skipped never synced

Provisioning

PATCH .../permissions/{table|volume}/{catalog}.{schema}.{name}, with an uncached pre-read deciding GrantAlreadyExists / GrantAlreadyRevoked and the echo confirming the write. owner is read-only and answers InvalidArgument, and so does a privilege the grants API refuses for that table_type — before any PATCH goes out.

Every write first rebuilds the securable from live reads, because the four owners the trust check short-circuits on — metastore, catalog, schema and the object itself — ride on the profile the last sync wrote, where they can be hours old. A table also re-reads table_type there, so a view replaced by a table is not checked against the recorded variant.

flowchart TD
  start[Grant or Revoke] --> live["live reads: metastore owner,<br/>catalog, schema, the table or volume"]
  live -->|recorded workspace still in scope and serving| trust[trust check on the securable]
  live -->|otherwise| walk[first running in-scope workspace that serves the catalog]
  walk --> trust
  live -->|names the object or a parent gone| gone{Grant or Revoke?}
  walk -->|no workspace serves the catalog| unproven[FailedPrecondition: deletion cannot be proved]
  gone -->|Grant| nf[NotFound]
  gone -->|Revoke| already[GrantAlreadyRevoked]
  trust --> read[uncached permissions pre-read]
  read --> patch[PATCH permissions, echo confirms]
Loading

Which 404 proves a deletion. On the sync path the read goes through the workspace the last sync wrote on the profile, so a 404 there can be a deletion or a workspace that no longer serves the catalog. Only a code naming the securable itself tells them apart, and that is TABLE_DOES_NOT_EXIST and nothing at all on a volume: measured on this tenant, the permissions endpoint answers RESOURCE_DOES_NOT_EXIST for a missing volume, a missing schema and a missing catalog alike, and never returns VOLUME_DOES_NOT_EXIST.

Every other code is confirmed before it is believed. The parent schema is read first through that same workspace; only a 200 there makes the securable's own 404 proof, which GET /tables/{full_name} or GET /volumes/{full_name} then settles. Any other answer from either read leaves the absence unproven and the caller refuses instead of reporting an empty list — the schema and catalog syncers walk every workspace, so a parent that is really gone is removed there, with its children. The confirmation costs two reads on a 404 and none on the happy path.

On the write path the same discipline is already in the route: the chosen workspace has just served the catalog and answered 200 for the schema, so a parent code at the leaf read is a deletion between two reads.

GET permissions/volume/<catalog>.<schema>.<missing>   404 RESOURCE_DOES_NOT_EXIST
GET permissions/volume/<catalog>.<missing schema>.x   404 RESOURCE_DOES_NOT_EXIST
GET volumes/<catalog>.<schema>.<missing>              404 RESOURCE_DOES_NOT_EXIST
GET volumes/<catalog>.<missing schema>.x              404 SCHEMA_DOES_NOT_EXIST
GET volumes/<catalog>.<schema>.<a volume that exists> 200

Measured on the Baton account

  • A sync of account, user, group, service principal, metastore, catalog, schema, table and volume exits 0 and emits the same counts three times: 325 resources, of which 1 catalog, 1 schema, 1 table and 1 volume, and 871 grants, 7 of them on the table and 6 on the volume. information_schema is not emitted.
  • The vendor answers in the volume block above were measured on this tenant.
  • The Grant, Grant, Revoke, Revoke cycle on a table and a volume privilege has not been re-run since the branch was rebased on [CXH-2722] - Add Unity Catalog schema sync - Databricks Connector #72. That is the measurement to repeat before this leaves draft.

Links

@linear-code

linear-code Bot commented Oct 9, 2026

Copy link
Copy Markdown

CXH-2723

…and metastore sync

Co-authored-by: Cursor <cursoragent@cursor.com>
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-schema-sync branch from 920df46 to f9142b4 Compare October 9, 2026 13:20
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from 0ee9040 to 38e403e Compare October 9, 2026 13:20
Co-authored-by: Cursor <cursoragent@cursor.com>
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-schema-sync branch from f9142b4 to 29274ee Compare October 9, 2026 14:27
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from 38e403e to 7c8e7a3 Compare October 9, 2026 14:27
…cope routing to the configured workspaces

The uhttp response cache holds a GET 200 for an hour and a PATCH does not
invalidate it, so Grant and Revoke could decide not to write against a page
that predated the last change: Grant X then Revoke X in the same process
left the principal with access while C1 recorded it as revoked. Both
pre-reads and the post-PATCH confirmation now bypass the cache.

Unity Catalog routing ignored the workspaces allowlist, because
ListWorkspaces only applies the exclude list, so a securable could be read
through a deployment the operator had scoped out of the sync.

A workspace the credential cannot read answered 401 or 403 out of
buildRouting, and only codes.NotFound is a warning to the SDK, so one
unreadable workspace failed the whole sync including the resource types
that already worked. It is now set aside the way a 404 already was.

Also: a revoke against a deleted metastore reports GrantAlreadyRevoked
rather than failing forever, the 403 remedy no longer names MANAGE (not
assignable on a metastore), and the connector's own service principal is
resolved with an applicationId filter instead of a full account SCIM walk.

Co-authored-by: Cursor <cursoragent@cursor.com>
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-schema-sync branch from 29274ee to e74210e Compare October 9, 2026 16:46
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from 7c8e7a3 to a3bd512 Compare October 9, 2026 16:46
…ut of scope

Filtering routing by the workspaces allowlist left a metastore that only an
out-of-scope workspace is attached to still listed on the account but with
no access path, so usableWorkspaces answered FailedPrecondition and, since
only codes.NotFound is a warning to the SDK, scoping a sync to one
workspace failed it for every metastore the others hold.

Such a metastore now reads as absent, the way a filtered catalog already
does, and List emits from the routing snapshot so it cannot advertise a
metastore whose grants cannot be read. The remedy text names the allowlist
alongside the exclude list.

Co-authored-by: Cursor <cursoragent@cursor.com>
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-schema-sync branch from e74210e to 7deff05 Compare October 9, 2026 16:54
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from a3bd512 to 5dce9b1 Compare October 9, 2026 16:54
mateoHernandez123 and others added 7 commits November 16, 2026 10:45
#71 moved on after this branch was cut: the trust check each securable
level runs now travels with the level through listProvesTrust, the
metastore route is re-checked on every use, and the README and the
connector doc gained the catalog failure modes. Schema sync keeps its own
trust read, because a schema listing proves nothing about the privileges
on it.

Conflicts resolved by keeping both sides: the renamed doc comments and
the level flag from #71, the trust-read classification and the
schema-aware wording from this branch.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The trust check that ends schema List reads the connector's own privileges
on the catalog, and that read names the catalog missing only when it is
gone: a workspace the catalog is not bound to refuses with 403, which
deniesTrust already catches. Returning that sentinel raw failed the whole
sync with codes.Unknown and no prefix whenever a catalog was dropped
between the listing that found it and this read.

List now walks on, and reports no schemas for a catalog every workspace
proved gone with none refusing, which is what the catalog syncer removes
in the same sync. A refusal anywhere in the walk still leaves the picture
unproven, so nothing is emptied on it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The setup section told the operator what makes the schema listing
complete and stopped there, so a service principal given only USE_SCHEMA
follows it, sees its schemas synced, and then fails on their grants:
ALL_PRIVILEGES and USE_SCHEMA list every schema, and neither reads the
privileges on one, because Databricks leaves MANAGE out of
ALL_PRIVILEGES. The connector doc, the README and the limitations now
state both requirements, as the catalog sections already do.

The README gains the schema layer it was missing in provisioning and
permissions, and the limitations gain the schema key, the skipped
information_schema and the opt-in rule. The information_schema reason is
the one the code states: Databricks creates it read-only and its
privileges cannot be granted.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
#71 kept moving after this branch was cut, and its review rounds left the
schema layer behind on four counts.

**Writes were decided from sync-time owners.** Grant and Revoke read the
metastore owner, the catalog owner and the schema owner off the profile the
last sync wrote, and those three are exactly what the trust check
short-circuits on. An ownership transfer away from the connector therefore
left a write being decided from a privilege list Databricks had already
started truncating, and Revoke could report a grant removed that is still
held. Both now rebuild the entitlement's schema the way the catalog does: the
metastore owner from a live listing, the catalog from the recorded workspace
when this sync still admits it and otherwise from the first running in-scope
workspace that serves it, and the schema itself from a new
GET /schemas/{full_name}. Both paths bypass the HTTP cache, because a
remembered page would decide the write with the access of an earlier one. A
catalog no workspace serves is still not proof of deletion, so that case
refuses with FailedPrecondition; only a vendor code naming the schema or its
catalog is an absence, answering NotFound on Grant and GrantAlreadyRevoked on
Revoke.

**The recorded workspace was reused without asking whether this sync still
admits it.** The write now goes through profileRoute, which answers the
allowlist and the exclude set off the profile, as the catalog does.

**A live sighting did not supersede an earlier gone answer.** The walk in
pushRoute could empty a catalog that a later workspace had just listed. The
reads run in order and a catalog cannot be absent before it is present, so a
workspace that serves it now clears the flag. A metastore proved gone also
stops returning its bare sentinel, which reaches C1 as Unknown and is retried;
the metastore syncer removes the parent in the same sync.

**The sync session never reached the shared path.** Schema List and Grants now
carry it, so the workspace-Admin check behind the trust rule is read once per
workspace per sync instead of once per schema. The listing also gained the
repeated-page-token guard the catalog listing has.

Measured on the Baton account: grant, repeat, revoke, repeat on
test_workspace.default leaves 7 grants then 6 with the annotations in that
order, and the privilege is visible to Grants in between. A full sync of
account, user, group, service principal, metastore, catalog and schema exits 0
with no errors, twice, emitting the same 29 catalog and 10 schema grants.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
connector.mdx prose uses C1 for the product, which luisina asked for on #71,
and the Go comments on staging follow the same convention. The schema layer
was written against the older wording and tipped the balance back: it added
eight "ConductorOne" to code comments. The lines #71 owns are left as they
are.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The test file was 931 lines built around a fake Databricks, and what it proved
was that the code does what it was written to do. The tenant run is what
answers whether the layer works, and QA runs the connector against a tenant
before production. Nothing else references the fake or its helpers, so the
package builds and tests clean without it. It stays on disk, excluded per
clone, for local iteration.

The comments had grown into paragraphs restating the code around them. Each
one is now the doc above its function, or a single line where a Databricks
behaviour decides the branch and is invisible from it: a 403 for an unbound
workspace, a leaf-named error code, the order the reads run in.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A comment naming the field it sits on, or restating the format the function
parses, costs a line and tells the reader nothing the next line does not. The
ones left are the ones carrying a reason: a Databricks behaviour, or why a
value is written down at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
mateoHernandez123 added a commit that referenced this pull request Nov 17, 2026
CXH-2723. Tables and volumes hang from the schema, each with its own
privilege set and a read-only owner.

The tree is unchanged from d10a7e9, the state reviewed and approved on #73.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from 34cecee to 9b8a7aa Compare November 17, 2026 13:18
mateoHernandez123 and others added 14 commits November 17, 2026 15:11
Five call sites asked the same question in two halves: the shared sentinel a
trust read raises, and the per-level one naming a securable or its parent. A
sixth would have had to remember both. isSecurableGoneSentinel now answers for
all three, so Grant, Revoke and the grants sync read as one condition.

The two sites that compare against errSecurableGone alone stay as they are:
catalog.go and schema.go translate it into their own per-level sentinel, so
widening them would lose the distinction they exist to make.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The warning made the exclusion conditional on a privilege list that cannot be
proven complete. The catalog sync skips a catalog named system, and any catalog
Databricks types SYSTEM_CATALOG, before it reads any privilege at all, so the
condition never applied. The page itself, the README and docs-info already said
it was unconditional.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…yncer

The schema syncer had its own copy of the walk that finds the workspace a
catalog is routed through, and the copies had drifted: the schema walk
ignored a gone answer, so revoking a grant on a schema whose catalog was
deleted failed with FailedPrecondition instead of returning
GrantAlreadyRevoked, and C1 kept retrying a revoke it could never land.

workspaceForCatalog now takes an acceptance predicate and reports a third
outcome, errCatalogNotAccepted, so the schema listing's completeness check
rides the shared walk instead of repeating it. liveCatalogRoute ends in
confirmCatalogGone, the route read from the profile is profileCatalogRoute,
and the entitlement rebuild is entitlementOnResource, which also checks the
type assertion the catalog path left bare.

Sharing the walk fixes a second divergence: a workspace that answers with a
catalog of another metastore left the schema walk able to conclude "gone"
off another workspace's 404, which would drop the catalog's schemas from
the sync and delete their grants. It now leaves the question open and
refuses.

Grant and Revoke return the write's annotations alone, as catalog.go does,
so C1 reads the PATCH's rate-limit budget instead of an earlier read's.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Reading a schema's grants needs MANAGE or ownership, but the type declared
only USE_CATALOG and USE_SCHEMA, so ./baton-databricks capabilities told
the admin to grant a privilege set the sync then fails on.

baton_capabilities.json is regenerated with the command the
capabilities_and_config workflow runs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The schema sections explained Databricks mechanics where the admin needs a
privilege to grant. They now lead with the grant, name the Metastore Admin
and the workspace id the way the catalog sections above them do, and drop
the sentences that repeat the system-catalog note.

docs-info.md no longer claims SchemaInfo exposes no immutable id: it does
expose schema_id, but no endpoint accepts it, which is the reason the
resource is keyed by name.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
CXH-2723. Tables and volumes hang from the schema, each with its own
privilege set and a read-only owner.

The tree is unchanged from d10a7e9, the state reviewed and approved on #73.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Listing a schema's tables or volumes resolved its route on the first page,
once per child type, and schemaThrough found the schema by paging the whole
catalog's schema listing. That is one full listing walk per schema per child
type: a catalog with 1,000 schemas spends about 21,000 listing requests, and
43,000 requests in all, before the first table is listed. The uhttp GET cache
hid it while a catalog's listing fit in the 5 MB it holds by default, which a
catalog of 30 KB schema rows does not.

schemaThrough now reads the one schema it needs. The same catalog costs 2,000
schema reads instead, and the cost is linear in the schema count rather than
quadratic.

Error classification is unchanged. A 404 naming SCHEMA_DOES_NOT_EXIST is read
exactly like a schema absent from the listing was: proof of deletion only for
a caller that sees the whole catalog, since Databricks answers the same way
for a schema the caller merely cannot see. Every other refusal, including a
404 carrying no code, still leaves the schema unknown rather than absent --
read as an empty result the SDK would skip the children and ConductorOne
would delete every table and volume under the schema.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Listing a schema's tables or volumes returned the catalog read's error for
every refusal, where the schema syncer walks on to the next workspace. A
catalog bound to one workspace of several is answered by the others with a
404, and which of the two answers Databricks gives decides which way this
breaks.

A 404 carrying no error code reached the SDK as codes.NotFound, which it
reads as a warning: the listing finished green with no resources and
ConductorOne deleted every table and volume under the schema. A 404 naming
CATALOG_DOES_NOT_EXIST raised errCatalogGone, which failed the whole sync.

Both now continue the walk, matching the schema syncer. A catalog every
workspace names as gone, with none refusing the read, empties the listing:
the catalog syncer drops it in the same sync. A refusal still fails the
sync and keeps what ConductorOne already has.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…hildren

schemaThrough classified every refusal of the single-schema read with
schemaListingError, which maps CATALOG_DOES_NOT_EXIST to codes.NotFound.
The SDK reads NotFound from a List as a warning, not a failure: isWarning
(sync/syncer.go) returns true for it and syncOneAction
(sync/parallel_syncer.go) logs "skipping sync action" and carries on. The
listing then completes having emitted nothing and ConductorOne deletes
every table and volume under that schema.

A parent-catalog 404 is a real answer there: measured on the tenant,
GET /schemas/{full} returns CATALOG_DOES_NOT_EXIST once the catalog is
dropped. So the read now refuses as unreadable, which reaches C1 as
FailedPrecondition and keeps what it already has. Only a code naming the
schema itself still reports errSchemaGone, and the caller decides what
that absence means.

The message drops the privilege remedy: it is the answer to a partial
listing, not to an arbitrary refusal, and on a 403 it contradicted the
remedy the client layer already appends. schemaReadError is inlined into
the branch that uses it, since it classified nothing.

Side effect worth naming: a 403 now reaches C1 as PermissionDenied and a
401 as Unauthenticated, where both were FailedPrecondition. Neither is a
warning, so neither changes what C1 keeps.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…landed

and volume layer behind on the same counts, one level deeper.

**Writes were decided from sync-time owners.** Grant and Revoke read the
metastore owner, the catalog owner, the schema owner and the securable's own
owner off the profile the last sync wrote, and those four are exactly what the
trust check short-circuits on. An ownership transfer away from the connector
therefore left a write being decided from a privilege list Databricks had
already started truncating, and Revoke could report a grant removed that is
still held. Both now rebuild the entitlement's table or volume the way the
schema does: the metastore owner from a live listing, the catalog from the
recorded workspace when this sync still admits it and otherwise from the first
running in-scope workspace that serves it, the schema from GET
/schemas/{full_name}, and the securable itself from a new GET
/tables/{full_name} or from GET /volumes/{full_name}. The whole path bypasses
the HTTP cache, because a remembered page would decide the write with the
access of an earlier one. A table also reads table_type live, so the write is
no longer checked against the variant the last sync happened to record.

**A live sighting did not supersede an earlier gone answer.** The walk in
pushSchemaChildRoute could empty a schema's children on a gone answer a later
workspace had already contradicted. The reads run in order and a catalog cannot
be absent before it is present, so a workspace that serves it now clears the
flag. A metastore the account no longer lists also stops returning its bare
sentinel; the metastore syncer removes the parent in the same sync.

**The sync session never reached the shared path.** The children listing and
the table and volume Grants now carry it, so the workspace-Admin check behind
the trust rule is read once per workspace per sync instead of once per
securable. The listing also gained the repeated-page-token guard the schema
listing has.

**A refused schema read stopped the walk.** Only the catalog read continued to
the next workspace, so a 401, 403 or 404 on the schema failed the sync even
where another in-scope workspace serves it. Both reads now walk on, and a
refusal left standing is still an error rather than an empty listing: emptying
one is reserved for a parent every workspace named as gone with none refusing.

GetTable and GetVolume check the name Databricks answers with, as GetCatalog and
GetSchema do, because the owner they report decides whether a privilege list is
complete. GetSchema now refuses an answer naming no schema at all for that same
reason, which is what the client test on this branch already asserted.

Not re-measured against the tenant yet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The file was 293 lines built on the fake Databricks account the schema tests
carried, and #72 dropped that fake with them. What it proved was that the code
does what it was written to do. The tenant run is what answers whether the layer
works, and QA runs the connector against a tenant before production.

Nothing tracked references the fake or its helpers any more, so the package
builds and tests clean without this file, which is the view CI gets. It stays
excluded per clone, next to the schema tests, for local iteration.

The client tests in pkg/databricks/unity_catalog_test.go stay: they assert the
query set a listing sends and the name a single read is allowed to answer with,
which is a contract rather than a restatement of the caller.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…volume traits

resource_types.go dropped TRAIT_APP from table and volume, because neither has
app semantics and a profile rides on any resource now. The committed
capabilities file still carried the trait, and its workflow only regenerates on
a push to main, so CI would not have caught it before the file reached the
customer-facing docs.

Regenerated with the same command the workflow runs. The trait is gone from both
types, and the volume's SkipEntitlements annotation moved with it; the volume
keeps a static entitlement set and the table does not, because its privileges
follow table_type.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…s needs

The setup sections stopped at the catalog and the schema, so an operator who
grants USE_SCHEMA follows them, sees the schemas synced, and then fails on the
tables and volumes under them: listing those needs ownership of the metastore,
the catalog or the schema, direct workspace Admin where the admins group owns
the catalog, or ALL_PRIVILEGES on the catalog, and reading one's privileges
needs ownership or MANAGE on it, its schema or its catalog. USE_SCHEMA and
MANAGE answer neither. The README, the connector doc and the limitations now
state both requirements, as the catalog and schema sections do.

The limitations also gain the table and volume keys, the one table securable
that covers views, materialized views, metric views and streaming tables, and
the privileges that are reported when already held but cannot be requested.

Two corrections ride along. The ownership limitation said a workspace admins
group is never shown; the principal resolver looks an owner name up against the
account groups, and a workspace admins group is one, so it is shown when it
resolves there. The limitation now says so, which is what the connector doc on
this branch already said. And the opt-in is a C1 setting, so it does not gate
the CLI: a local run with no selection syncs every type and fails on a service
principal that cannot list every table and volume. The README now says to pass
--sync-resource-types there.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…e is gone

A 404 on the permissions endpoint decided whether Grants reports no grants and
Revoke answers GrantAlreadyRevoked. The table level took SCHEMA_DOES_NOT_EXIST
and CATALOG_DOES_NOT_EXIST as proof, and the volume level took those plus the
generic RESOURCE_DOES_NOT_EXIST after reading the volume through the same
workspace. Every one of those codes also comes back from a workspace that
cannot serve the catalog, and the sync path reads through the workspace the
last sync wrote on the profile, so a binding that changed since then made a
revoke report success while the privilege was still held, and emptied the
securable's grants in C1.

The parent is now read first through that same workspace. Only a schema it
answers 200 for makes the securable's own 404 proof; the securable is then read
with GET /tables/{full_name} or GET /volumes/{full_name}, and a 404 there is a
deletion. Any other answer, from either read, leaves the absence unproven, so
the caller refuses rather than reporting an empty list. The parent syncer walks
every workspace and removes the parent with its children when it is really gone.

Only a code naming the securable itself stays unambiguous, which is
TABLE_DOES_NOT_EXIST and nothing on a volume: Databricks never returns
VOLUME_DOES_NOT_EXIST. The confirmation costs two reads on a 404 and none on
the happy path.

The write path already had this discipline after the live-route change:
liveChildRoute has the chosen workspace serve the catalog and answer 200 for
the schema before the leaf is read, so a parent code there is a deletion
between two reads. The comments now say so.

schema_child_gone_test.go pins the contract in five cases for both levels:
parent served plus a leaf 404 is gone, parent served plus a leaf 200 is not,
and a parent that answers 404, answers 403, or a leaf read that fails leaves it
unproven with no leaf read attempted when the parent did not answer.

A full tenant sync still exits 0 with the same counts as before the change:
871 grants, 7 on the table and 6 on the volume.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from f16c40a to 4c26675 Compare November 18, 2026 16:27
@luisina-santos
luisina-santos force-pushed the mateoHernandez123/unity-catalog-schema-sync branch 2 times, most recently from b4d3cce to a6fa4d5 Compare November 25, 2026 16:45
#72 was rewritten onto the v0.47.1 SDK base, so this branch no longer shared a
recent ancestor with it and GitHub reported the PR as conflicting. The merge
takes #72's tree for every path this branch does not touch — vendor, go.mod,
the CI workflows and test-server among them, none of which this branch changed
— and replays this branch's own twenty files on top.

Three of them needed adapting to shapes that landed on #72 after this branch
forked:

  * schema_child.go passes the noRoute fragment liveCatalogRoute now takes, and
    reads the pending workspace list that scope.attached returns in place of
    the old in-scope boolean.
  * table.go and volume.go pass the nil local-principal resolver that syncGrants
    now takes, the same as the catalog and schema levels.
  * schema.go keeps #72's shared liveCatalogRoute instead of this branch's own
    copy, which returned a schemaRoute and could not serve the catalog level.

The documentation merges keep both sides: this branch extends every securable
list to tables and volumes, and #72's account-lifecycle actions, Delete column
and workspace-admins notes stay. The table and volume listing paragraph moves
to the end of the schema permissions section, where the credentials block that
used to follow it now sits.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants