Repository navigation
fix(tables): keep schemaDefinition when dbt adds a data model [Backport #38285 - 2.0] - #38462
Conversation
(cherry picked from commit 5bd5fa2)
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ Approved 🟡 Medium riskPreserving schemaDefinition on data-model PUTs and bypassing hash skips for missing definitions could trigger fuller table metadata updates during ingestion. Backports the fix that keeps VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
| * writes the entire row back with {@code dao.update}, so it cannot start from {@code get()}: that | ||
| * nulls every field not requested, and the write then deleted them, schemaDefinition among them. | ||
| */ | ||
| private Table getWholeStoredTable(UUID tableId) { |
There was a problem hiding this comment.
New declarations miss required
final
The new helpers and tests omit final from parameters and local variables that never change. CLAUDE.md requires it for both. Add it to the new declarations, including tableId here, stored and incoming in hasLostSourceFields, and the new test variables. This repository requirement must be satisfied before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
|
||
| // The stored row lacks a definition its sourceHash covers: the state a write that dropped | ||
| // the definition leaves behind. Re-sending it under the same hash must still store it. | ||
| BulkApi.upsert("tables", List.of(view(ns, schemaFqn, "fp_lost_ddl", VIEW_DDL))); |
There was a problem hiding this comment.
The new test repeats "fp_lost_ddl" when creating and updating the same view. CLAUDE.md requires repeated strings to have one named definition. Define the view name once and reuse it so the requests cannot drift apart. This repository requirement must be satisfied before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Backport of #38285 (5bd5fa2) to
2.0. Issue: #38427.What
PUT /v1/tables/{id}/dataModeldeleted the table'sschemaDefinition, and later metadata ingestion runs never brought it back. dbt ingestion calls this endpoint for every dbt model and source it matches to a table. #38285 has the full description.TableRepository.addDataModelnow reads the whole stored row before writing it back, so it no longer dropsschemaDefinition.sourceHashskip no longer applies when the stored row lacks aschemaDefinitionthat the request carries. The next ingestion run therefore restores the definitions that were already deleted.Differences from the main commit
None. The pick applied cleanly and has the same
git patch-id --stableas 5bd5fa2. Every method and test helper it uses exists on 2.0 with the same signature.Tests
TableResourceIT#put_dataModel_keepsSchemaDefinitionandBulkSourceHashFastPathIT#test_matchingSourceHash_storesSchemaDefinitionTheRowLacksfail on 2.0 without the fix (expected: <CREATE VIEW …> but was: <null>) and pass with it.TableResourceIT,BulkSourceHashFastPathITandTableDataModelCertificationITon MySQL + Elasticsearch, parallel lane: 337 run, 0 failures, 0 errors. The 9 skips are the existing capability gates.PUT /tables/{id}/dataModeldeleted a view's definition without changing its version.PUT /tables/bulkrestored the definition (version 0.2 → 0.3). That request had the samesourceHashandoverrideMetadata=false. A second dbt PUT kept the definition.spotless:checkpasses onopenmetadata-serviceandopenmetadata-integration-tests.Type of change
🤖 Generated with Claude Code
The behavior looks correct, but the explicit Java style requirements must be satisfied before merging.
Findings
Summary
Preserves
schemaDefinitionwhen dbt adds a data model and lets bulk ingestion restore definitions lost by earlier writes.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[dbt adds a data model] --> B[Read complete stored table] B --> C[Merge model and save] C --> D[Keep stored schema definition] E[Bulk ingestion with matching hash] --> F{Incoming definition missing from storage?} F -->|Yes| G[Run normal update and restore definition] F -->|No| H[Skip unchanged table]Reviews (1) · Last reviewed commit: "fix(tables): keep schemaDefinition when ..." · Reviewed by Greptile