Fix DBT converter round-trip losses entity issue - #315
Open
MonkeyCanCode wants to merge 2 commits into
Open
Conversation
Contributor
Author
|
@QMalcolm mind take a look? |
There was a problem hiding this comment.
🟡 Changes recommended
The code change also affects UNIQUE and FOREIGN entity classification, but the added regression test only covers PRIMARY, leaving key paths untested.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes a round-trip conversion bug in the DBT converter where PRIMARY/UNIQUE/FOREIGN entities could be silently dropped during MSI → Ossie → MSI when the entity expr differs from the entity name.
Changes:
- Update
OssieToMSIConverterfield classification to recognize keys by eitherfield.nameor the field expression (expr). - Add a regression test to ensure a PRIMARY entity with
expr != namesurvives MSI → Ossie → MSI.
File summaries
| File | Description |
|---|---|
converters/dbt/src/ossie_dbt/ossie_to_msi.py |
Classifies PRIMARY/UNIQUE/FOREIGN entities by matching either field.name or expr against key sets. |
converters/dbt/tests/test_ossie_to_msi.py |
Adds a regression test covering the PRIMARY entity expr != name round-trip case. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| assert len(sm.entities) == 1 | ||
| assert sm.entities[0].name == "customer_id" | ||
| assert sm.entities[0].expr == "id" | ||
| assert sm.entities[0].type is EntityType.PRIMARY |
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.
Summary
Currently a primary, unique, and foreign entity whose expression differs from its name is silently lost on MSI → OSI → MSI conversion. This is due to the following:
From
converters/dbt/src/ossie_dbt/msi_to_osi.py, we have following:However, from
converters/dbt/src/ossie_dbt/osi_to_msi.pyfollowing:Here is the local test result with the fixed code and newly added test:
Related Issues
Checklist
Specification
core-spec/and follow the existing structureOntology
ontology/are consistent with spec changesConverters
converters/is updated to reflect spec or ontology changesValidation
validation/are updated if the spec changedDocumentation
docs/is updated to reflect any user-facing changesCONTRIBUTING.mdis updated if the contribution process changedExamples
examples/are added or updated for any new spec constructs or converter supportTests
pytest/ CI green)Compliance