fix(contracts): export all ODCS v3.1.0 fields from _build_contract_api_model#296
Closed
ashmeet-kandhari wants to merge 1 commit into
Closed
Conversation
…i_model Fixes databrickslabs#295 Several fields were stored on import but silently dropped on read/export. All changes are export-only; no schema migrations required. - slaProperties: replace flat {property: value} dict with proper List[SLAProperty] including description, scheduler, schedule, valueExt, unit, element, driver (fixes round-trip for all SLA fields) - slaDefaultElement, contractCreatedTs: add to DataContractRead return - Team members: export name and description (added in d1 migration) - Team metadata: query DataContractTeamMetadataDb and expose as teamMetadata on DataContractRead (adds field to model) - Schema objects: export stableId, dataGranularityDescription; batch-load and export authoritativeDefinitions, customProperties, relationships from three separate tables - Schema properties: export stableId; batch-load and export authoritativeDefinitions, relationships from two separate tables All batch queries follow the existing pattern (one query per table, group by parent id) to avoid N+1 issues.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #295
Problem
The
d1_odcs_v310_full_persistencemigration added the correct tables and import logic for several ODCS v3.1.0 fields, but_build_contract_api_modelwas not updated. Fields stored on upload were silently absent from the read/export response, breaking round-trip fidelity.Changes
All changes are export-only — no new migrations required.
data_contracts_manager.py—_build_contract_api_model{property: value}dict with properList[SLAProperty], includingdescription,scheduler,schedule,valueExt,unit,element,driver; addslaDefaultElementandcontractCreatedTsto responsenameanddescription(added byd1migration, present in model, not exported)DataContractTeamMetadataDband return asteamMetadatastableId,dataGranularityDescription; batch-loadauthoritativeDefinitions,customProperties,relationshipsstableId; batch-loadauthoritativeDefinitions,relationshipsBatch queries follow the existing single-query-per-table pattern (group by parent id) to avoid N+1 issues.
data_contracts_api.py—DataContractReadteamMetadata: Optional[TeamMetadataRead] = Nonefield (backwards-compatible; existing responses are unchanged, new field defaults tonull)Backwards compatibility
All new fields are optional/nullable. Existing clients that do not read
teamMetadata,slaProperties, or the new schema sub-fields are unaffected. The only behavioural change is thatslaPropertiesnow returns a structured list instead of an empty dict — clients already reading this field via the ODCS spec will benefit.ODCS v3.1.0 reference
https://github.com/bitol-io/open-data-contract-standard/blob/main/schema/odcs-json-schema-v3.1.0.json