Skip to content

Support SQLAlchemy polymorphic / table inheritance - #54

Merged
JoseVelazcoH merged 4 commits into
developfrom
issue-5-inheritance-edges
Aug 17, 2026
Merged

JoseVelazcoH merged 4 commits into
developfrom
issue-5-inheritance-edges

Conversation

@zamax14

@zamax14 zamax14 commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Detects SQLAlchemy joined-table inheritance from mapper metadata.
  • Emits inheritance relationships separately from FK relationships to avoid duplicate edges.
  • Renders inheritance edges with a distinct dashed line, hollow arrow, and strategy label in HTML and SVG.

Tests

  • .venv/bin/python -m pytest tests/test_introspect.py tests/test_html_renderer.py tests/test_renderer.py
  • .venv/bin/python -m pytest

Documentation

  • TODO: documentation is intentionally deferred to a follow-up issue so these functional issue PRs do not conflict with each other while being reviewed.

@zamax14
zamax14 marked this pull request as ready for review June 29, 2026 08:18
@zamax14
zamax14 requested a review from JoseVelazcoH June 29, 2026 08:18
@zamax14 zamax14 self-assigned this Jun 29, 2026
@zamax14 zamax14 linked an issue Jun 29, 2026 that may be closed by this pull request
@zamax14
zamax14 marked this pull request as draft June 29, 2026 08:20
@zamax14
zamax14 marked this pull request as ready for review June 29, 2026 08:21
zamax14 and others added 3 commits July 30, 2026 14:23
…e-edges

# Conflicts:
#	tests/conftest.py
#	tests/test_introspect.py
Deduplicating FK edges by (from_table, to_table) removed every foreign
key between a child and its inherited parent, not just the join column,
so business relationships to the same parent silently vanished from the
diagram. Match on the fk_column too, and resolve the join column as the
child primary key that references the parent.

Drop the unreachable "single" strategy branch: single-table inheritance
is skipped earlier because parent and child share a table.

Move the edge-kind and strategy literals into constants/relationships.py,
and split the inheritance and cardinality schemas out of conftest.py.
…e-edges

Conflict in tests/conftest.py: develop added the column-comments fixture
where this branch had moved the cardinality schema out. Kept both by
extracting the comments schema into tests/fixtures/comments.py.
@JoseVelazcoH

Copy link
Copy Markdown
Owner

Fix: inheritance dedupe dropped unrelated foreign keys

The dedupe matched on (from_table, to_table), removing every FK between a child and its inherited parent, not just the join column. A second FK to the same parent (Lead.mentor_id -> staff.id) vanished from the diagram silently.

Now dedupes on (from_table, to_table, fk_column), and resolves the join column as the child PK that references the parent. Regression test adde

@JoseVelazcoH
JoseVelazcoH merged commit 4c62bd7 into develop Aug 17, 2026
3 checks passed
@JoseVelazcoH
JoseVelazcoH deleted the issue-5-inheritance-edges branch August 17, 2026 16:40
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.

Support SQLAlchemy polymorphic / table inheritance

2 participants