Skip to content

Conversation

@xnuinside
Copy link
Owner

  • Add new relationships parameter to create_models() function
  • Generate bidirectional relationships with back_populates for foreign keys
  • Support both sqlalchemy and sqlalchemy_v2 model types:
    • For sqlalchemy: uses relationship("Model", back_populates="attr")
    • For sqlalchemy_v2: uses Mapped[List["Model"]] and Mapped["Model"] type hints
  • Add collect_relationships() function to gather FK relationships from tables
  • Handle both inline FK references and ALTER TABLE FK definitions
  • Add functional and integration tests for both model types
  • Update CHANGELOG with new feature documentation

- Add new `relationships` parameter to `create_models()` function
- Generate bidirectional relationships with `back_populates` for foreign keys
- Support both `sqlalchemy` and `sqlalchemy_v2` model types:
  - For sqlalchemy: uses `relationship("Model", back_populates="attr")`
  - For sqlalchemy_v2: uses `Mapped[List["Model"]]` and `Mapped["Model"]` type hints
- Add `collect_relationships()` function to gather FK relationships from tables
- Handle both inline FK references and ALTER TABLE FK definitions
- Add functional and integration tests for both model types
- Update CHANGELOG with new feature documentation
@xnuinside xnuinside merged commit 9a606ff into main Jan 18, 2026
11 checks passed
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.

2 participants