Skip to content

fix(dbt): compatibility with pydantic v1 results and fixing the semantic format of flights.yaml - #327

Open
meiliangdeng wants to merge 3 commits into
apache:mainfrom
meiliangdeng:main
Open

fix(dbt): compatibility with pydantic v1 results and fixing the semantic format of flights.yaml#327
meiliangdeng wants to merge 3 commits into
apache:mainfrom
meiliangdeng:main

Conversation

@meiliangdeng

@meiliangdeng meiliangdeng commented Aug 14, 2026

Copy link
Copy Markdown

Summary

run osi-to-msi command using following:
ossie-dbt osi-to-msi -i ../../examples/flights.yaml -o semantic_manifest.json

2 exceptions occurred:

  • exception 1:
Traceback (most recent call last):
  File "/Users/small/dev/venv/venv0/bin/ossie-dbt", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/small/dev/venv/venv0/lib/python3.12/site-packages/ossie_dbt/cli.py", line 104, in main
    _cmd_osi_to_msi(args)
  File "/Users/small/dev/venv/venv0/lib/python3.12/site-packages/ossie_dbt/cli.py", line 78, in _cmd_osi_to_msi
    output_path.write_text(result.output.model_dump_json(by_alias=True, exclude_none=True, indent=2))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PydanticSemanticManifest' object has no attribute 'model_dump_json'

cause: msi_pydantic_shim.py use pydantic v1 format for v1 and v2 in https://github.com/dbt-labs/metricflow/blob/main/msi_pydantic_shim.py, pydantic v1 result don`t include model_dump_json, so it must be use v1

  • exception 2:
  File "/Users/small/dev/venv/venv0/lib/python3.12/site-packages/ossie_dbt/cli.py", line 91, in _cmd_osi_to_msi
    document = OSIDocument.model_validate(raw)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/small/dev/venv/venv0/lib/python3.12/site-packages/pydantic/main.py", line 732, in model_validate
    return cls.__pydantic_validator__.validate_python(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for OSIDocument
semantic_model
  Field required [type=missing, input_value={'version': '0.2.0.dev0',...p': 'departure'}]}]}]}]}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.13/v/missing

cause: the ontology_mappings field does not meet the standard format in flights.yaml , therefore it is occurred

Related Issues

Checklist

Specification

  • Spec changes are included in core-spec/ and follow the existing structure
  • Spec changes have been discussed on the mailing list or in a linked issue
  • Breaking changes to the spec are clearly called out in the summary

Ontology

  • Ontology changes in ontology/ are consistent with spec changes
  • New or modified terms are defined and documented

Converters

  • Converter logic in converters/ is updated to reflect spec or ontology changes
  • New converters include tests under the converter's test directory

Validation

  • Validation rules in validation/ are updated if the spec changed
  • New validation cases are covered by tests

Documentation

  • docs/ is updated to reflect any user-facing changes
  • New features or behaviors are documented with examples where appropriate
  • CONTRIBUTING.md is updated if the contribution process changed

Examples

  • examples/ are added or updated for any new spec constructs or converter support

Tests

  • All existing tests pass (pytest / CI green)
  • New functionality is covered by tests

Compliance

  • ASF license headers are present on all new source files
  • No third-party dependencies are added without PMC/IPMC approval

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.

1 participant