René's URL Explorer Experiment


Title: SQLAlchemy version 1.4.36 breaks SQLModel relationships · Issue #315 · fastapi/sqlmodel · GitHub

Open Graph Title: SQLAlchemy version 1.4.36 breaks SQLModel relationships · Issue #315 · fastapi/sqlmodel

X Title: SQLAlchemy version 1.4.36 breaks SQLModel relationships · Issue #315 · fastapi/sqlmodel

Description: First Check I added a very descriptive title to this issue. I used the GitHub search to find a similar issue and didn't find it. I searched the SQLModel documentation, with the integrated search. I already searched in Google "How to X in...

Open Graph Description: First Check I added a very descriptive title to this issue. I used the GitHub search to find a similar issue and didn't find it. I searched the SQLModel documentation, with the integrated search. I...

X Description: First Check I added a very descriptive title to this issue. I used the GitHub search to find a similar issue and didn't find it. I searched the SQLModel documentation, with the integrated searc...

Opengraph URL: https://github.com/fastapi/sqlmodel/issues/315

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"SQLAlchemy version 1.4.36 breaks SQLModel relationships","articleBody":"### First Check\r\n\r\n- [X] I added a very descriptive title to this issue.\r\n- [X] I used the GitHub search to find a similar issue and didn't find it.\r\n- [X] I searched the SQLModel documentation, with the integrated search.\r\n- [X] I already searched in Google \"How to X in SQLModel\" and didn't find any information.\r\n- [X] I already read and followed all the tutorial in the docs and didn't find an answer.\r\n- [X] I already checked if it is not related to SQLModel but to [Pydantic](https://github.com/samuelcolvin/pydantic).\r\n- [X] I already checked if it is not related to SQLModel but to [SQLAlchemy](https://github.com/sqlalchemy/sqlalchemy).\r\n\r\n**👆 Not quite true - this is definitely related to SQLAlchemy!**\r\n\r\n### Commit to Help\r\n\r\n- [X] I commit to help with one of those options 👆\r\n\r\n### Example Code\r\n\r\n```python\r\nfrom typing import Optional\r\n\r\nfrom sqlmodel import Field, Relationship, SQLModel\r\n\r\n\r\nclass City(SQLModel, table=True):\r\n    name: str = Field(primary_key=True)\r\n    heroes: \"Hero\" = Relationship(back_populates=\"city\")\r\n\r\nclass Hero(SQLModel, table=True):\r\n    name: str = Field(primary_key=True)\r\n    city_name: Optional[str] = Field(default=None,foreign_key=\"city.name\")\r\n    city: Optional[City] = Relationship(back_populates=\"heroes\",\r\n                              sa_relationship_kwargs=dict(cascade=\"all,delete\")\r\n                              )\r\n\r\n\r\nif __name__ == \"__main__\":\r\n\r\n    gotham = City(name=\"Gotham\")\r\n    batman = Hero(name=\"Batman\", city=gotham)\r\n\r\n    assert batman.name == 'Batman' # This is fine\r\n    assert batman.city == gotham # This now breaks\r\n```\r\n\r\n\r\n### Description\r\n\r\nOur CI suddenly started failing, despite local SQLModel working fine. The issues turns out to be the transitive dependency on SQLAlchemy, which is weakly pinned: Github Actions pulled the latest version (`1.4.36`) and most of our tests started failing.\r\n\r\nhttps://github.com/sqlalchemy/sqlalchemy/releases/tag/rel_1_4_36\r\n\r\nThe problem seems to be related to how relationships are defined, but I haven't yet dug into the SQLAlchemy changes enough to understand why that is.\r\n\r\nI'm opening this issue chiefly to help anybody else who is confused by why suddenly their tests are failing. I'm happy to help fix it if it's affecting others too. \r\n\r\nFor the time being we have just pinned `SQLAlchemy==1.4.34` in our `requirements.txt`.\r\n\r\n### Operating System\r\n\r\nLinux, macOS\r\n\r\n### Operating System Details\r\n\r\nReplicated locally and on Github Actions, both running in Docker\r\n\r\n### SQLModel Version\r\n\r\n0.0.6\r\n\r\n### Python Version\r\n\r\n3.9.10\r\n\r\n### Additional Context\r\n\r\nWe were previously running SQLAlchemy 1.4.34 locally and that works fine. Pinning to 1.4.36 breaks SQLModel.","author":{"url":"https://github.com/archydeberker","@type":"Person","name":"archydeberker"},"datePublished":"2022-04-27T15:24:19Z","url":"https://github.com/fastapi/sqlmodel/issues/315"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:11b8e6fd-d708-202b-686b-26e899ae81eb
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9B84:2A5E57:16317E:1E7B59:6AFE0576
html-safe-nonce4b17c27408c56c5d36cc00c024ee40d33805d6b2494981c4a62d22f5a780ec66
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Qjg0OjJBNUU1NzoxNjMxN0U6MUU3QjU5OjZBRkUwNTc2IiwidmlzaXRvcl9pZCI6IjUwODkzOTY0Mzc3Nzk2MTMwNDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac15b26198f1b4e1a5bbdbb9e103e8a1c394c60432f72d5f30fa57bb036556571f
hovercard-subject-tagissue:1217515487
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/fastapi/sqlmodel/315/issue_layout
twitter:imagehttps://opengraph.githubassets.com/033a6d60d2e9d58513b1680115c04ec444bf37a635f745205eceb6c9ae137de4/fastapi/sqlmodel/issues/315
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/033a6d60d2e9d58513b1680115c04ec444bf37a635f745205eceb6c9ae137de4/fastapi/sqlmodel/issues/315
og:image:altFirst Check I added a very descriptive title to this issue. I used the GitHub search to find a similar issue and didn't find it. I searched the SQLModel documentation, with the integrated search. I...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamearchydeberker
hostnamegithub.com
expected-hostnamegithub.com
None86d46ece7c3d9b0562692f81a135cb55ad6a1c82c93ab1ac874d2f1b46b28958
turbo-cache-controlno-preview
go-importgithub.com/fastapi/sqlmodel git https://github.com/fastapi/sqlmodel.git
octolytics-dimension-user_id156354296
octolytics-dimension-user_loginfastapi
octolytics-dimension-repository_id399495186
octolytics-dimension-repository_nwofastapi/sqlmodel
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id399495186
octolytics-dimension-repository_network_root_nwofastapi/sqlmodel
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release5c18e6799976b7bc2f21178024289bb98edbcc85
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/fastapi/sqlmodel/issues/315#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffastapi%2Fsqlmodel%2Fissues%2F315
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffastapi%2Fsqlmodel%2Fissues%2F315
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=fastapi%2Fsqlmodel
Reloadhttps://github.com/fastapi/sqlmodel/issues/315
Reloadhttps://github.com/fastapi/sqlmodel/issues/315
Reloadhttps://github.com/fastapi/sqlmodel/issues/315
fastapihttps://github.com/fastapi
sqlmodelhttps://github.com/fastapi/sqlmodel
Codehttps://github.com/fastapi/sqlmodel
Issues1 (1)https://github.com/fastapi/sqlmodel/issues
Pull requests53 (53)https://github.com/fastapi/sqlmodel/pulls
Discussionshttps://github.com/fastapi/sqlmodel/discussions
Actionshttps://github.com/fastapi/sqlmodel/actions
Projectshttps://github.com/fastapi/sqlmodel/projects
Security and qualityhttps://github.com/fastapi/sqlmodel/security
Insightshttps://github.com/fastapi/sqlmodel/insights
https://github.com/fastapi/sqlmodel
New issuehttps://github.com/login?return_to=https://github.com/fastapi/sqlmodel/issues/315
New issuehttps://github.com/login?return_to=https://github.com/fastapi/sqlmodel/issues/315
SQLAlchemy version 1.4.36 breaks SQLModel relationshipshttps://github.com/fastapi/sqlmodel/issues/315#top
answeredhttps://github.com/fastapi/sqlmodel/issues?q=state%3Aopen%20label%3A%22answered%22
bugSomething isn't workinghttps://github.com/fastapi/sqlmodel/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/archydeberker
archydeberkerhttps://github.com/archydeberker
on Apr 27, 2022https://github.com/fastapi/sqlmodel/issues/315#issue-1217515487
Pydantichttps://github.com/samuelcolvin/pydantic
SQLAlchemyhttps://github.com/sqlalchemy/sqlalchemy
https://github.com/sqlalchemy/sqlalchemy/releases/tag/rel_1_4_36https://github.com/sqlalchemy/sqlalchemy/releases/tag/rel_1_4_36
Nexthttps://github.com/fastapi/sqlmodel/issues/315?timeline_page=1
archydeberkerhttps://github.com/archydeberker
questionFurther information is requestedhttps://github.com/fastapi/sqlmodel/issues?q=state%3Aopen%20label%3A%22question%22
on Apr 27, 2022https://github.com/fastapi/sqlmodel/issues/315#event-6507981231
https://github.com/antont
antonthttps://github.com/antont
on Apr 27, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1111171567
https://github.com/JLHasson
JLHassonhttps://github.com/JLHasson
on Apr 27, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1111487335
frankie567https://github.com/frankie567
on Apr 28, 2022https://github.com/fastapi/sqlmodel/issues/315#event-6512633909
Pin SQLAlchemy to prevent bug fastapi/sqlmodel#315https://github.com/fastapi-users/fastapi-users-db-sqlmodel/commit/6ff379c362e59ce723641c7f8deaf6a9c864f0d3
fastapi/sqlmodel#315https://github.com/fastapi/sqlmodel/issues/315
6ff379chttps://github.com/fastapi-users/fastapi-users-db-sqlmodel/commit/6ff379c362e59ce723641c7f8deaf6a9c864f0d3
https://github.com/byrman
byrmanhttps://github.com/byrman
on Apr 28, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1112204731
https://github.com/sqlalchemy/sqlalchemy/blob/main/lib/sqlalchemy/orm/decl_api.py#L114https://github.com/sqlalchemy/sqlalchemy/blob/main/lib/sqlalchemy/orm/decl_api.py#L114
https://github.com/jossefaz
jossefazhttps://github.com/jossefaz
on Apr 28, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1112314487
@byrmanhttps://github.com/byrman
https://github.com/byrman
byrmanhttps://github.com/byrman
on Apr 28, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1112348327
herehttps://github.com/tiangolo/sqlmodel/blob/main/sqlmodel/main.py#L371
https://github.com/jossefaz
jossefazhttps://github.com/jossefaz
on Apr 30, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1114062135
sqlalchemy/sqlalchemy#7972 (reply in thread)https://github.com/sqlalchemy/sqlalchemy/discussions/7972#discussioncomment-2655517
https://github.com/byrman
byrmanhttps://github.com/byrman
on May 1, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1114162812
https://github.com/byrman
byrmanhttps://github.com/byrman
on May 1, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1114170542
#322https://github.com/fastapi/sqlmodel/pull/322
https://github.com/maresb
maresbhttps://github.com/maresb
on May 6, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1119641377
akrantz01https://github.com/akrantz01
on May 7, 2022https://github.com/fastapi/sqlmodel/issues/315#event-6567217695
Pin sqlalchemy to 1.4.35 to fix broken relationshipshttps://github.com/WaffleHacks/application-portal/commit/46deb2c3b5fd1cdc6f4d9f678e0d6935c8d475eb
46deb2chttps://github.com/WaffleHacks/application-portal/commit/46deb2c3b5fd1cdc6f4d9f678e0d6935c8d475eb
Sherevvhttps://github.com/Sherevv
on May 11, 2022https://github.com/fastapi/sqlmodel/issues/315#event-6591527161
Update requirements, fix SQLAlchemy versionhttps://github.com/Sherevv/fastapi-react-docker/commit/100afa6e421a0584c48a98fab695c90df5d56b0a
100afa6https://github.com/Sherevv/fastapi-react-docker/commit/100afa6e421a0584c48a98fab695c90df5d56b0a
https://github.com/eddywee
eddyweehttps://github.com/eddywee
on May 18, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1130286322
@archydeberkerhttps://github.com/archydeberker
jeremyadamsfisherhttps://github.com/jeremyadamsfisher
on May 20, 2022https://github.com/fastapi/sqlmodel/issues/315#event-6653927939
Fix sqlmodel relationship issuehttps://github.com/jeremyadamsfisher/story-circle-ai/commit/b1cccc7a95600317ba8e9236919e4573e0b1120f
b1cccc7https://github.com/jeremyadamsfisher/story-circle-ai/commit/b1cccc7a95600317ba8e9236919e4573e0b1120f
https://github.com/tiangolo
tiangolohttps://github.com/tiangolo
on Aug 27, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1229239354
@archydeberkerhttps://github.com/archydeberker
@byrmanhttps://github.com/byrman
#322https://github.com/fastapi/sqlmodel/pull/322
tiangolohttps://github.com/tiangolo
bugSomething isn't workinghttps://github.com/fastapi/sqlmodel/issues?q=state%3Aopen%20label%3A%22bug%22
answeredhttps://github.com/fastapi/sqlmodel/issues?q=state%3Aopen%20label%3A%22answered%22
questionFurther information is requestedhttps://github.com/fastapi/sqlmodel/issues?q=state%3Aopen%20label%3A%22question%22
on Aug 27, 2022https://github.com/fastapi/sqlmodel/issues/315#event-7272385552
github-actionshttps://github.com/apps/github-actions
answeredhttps://github.com/fastapi/sqlmodel/issues?q=state%3Aopen%20label%3A%22answered%22
on Aug 29, 2022https://github.com/fastapi/sqlmodel/issues/315#event-7274515931
tiangolohttps://github.com/tiangolo
answeredhttps://github.com/fastapi/sqlmodel/issues?q=state%3Aopen%20label%3A%22answered%22
on Aug 29, 2022https://github.com/fastapi/sqlmodel/issues/315#event-7276414622
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Sep 7, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1238768343
github-actionshttps://github.com/apps/github-actions
completedhttps://github.com/fastapi/sqlmodel/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Sep 7, 2022https://github.com/fastapi/sqlmodel/issues/315#event-7334507509
https://github.com/mathieu-lemay
mathieu-lemayhttps://github.com/mathieu-lemay
on Oct 7, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1272122306
https://github.com/byrman
byrmanhttps://github.com/byrman
on Oct 8, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1272282914
lineshttps://github.com/tiangolo/sqlmodel/blob/main/sqlmodel/main.py#L330
https://github.com/byrman
byrmanhttps://github.com/byrman
on Oct 8, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1272292407
@mathieu-lemayhttps://github.com/mathieu-lemay
#461https://github.com/fastapi/sqlmodel/pull/461
https://github.com/mathieu-lemay
mathieu-lemayhttps://github.com/mathieu-lemay
on Oct 11, 2022https://github.com/fastapi/sqlmodel/issues/315#issuecomment-1274689225
@byrmanhttps://github.com/byrman
mxmrlthttps://github.com/mxmrlt
on Aug 28, 2023https://github.com/fastapi/sqlmodel/issues/315#event-10210029523
Fix SQLAlchemy version 1.4.36 breaks SQLModel relationships (fastapi#315https://github.com/mxmrlt/sqlmodel/commit/29f5bc51415bea5f819e6a864753279eb65dc963
fastapi#315https://github.com/fastapi/sqlmodel/issues/315
29f5bc5https://github.com/mxmrlt/sqlmodel/commit/29f5bc51415bea5f819e6a864753279eb65dc963
tiangolohttps://github.com/tiangolo
on Oct 22, 2023https://github.com/fastapi/sqlmodel/issues/315#event-10733159505
🐛 Fix SQLAlchemy version 1.4.36 breaks SQLModel relationships (#315) (#…https://github.com/fastapi/sqlmodel/commit/d5219aa3c55c5cb1ed2c0b1a665ef2ad10da425c
#315https://github.com/fastapi/sqlmodel/issues/315
#…https://github.com/fastapi/sqlmodel/pull/461
d5219aahttps://github.com/fastapi/sqlmodel/commit/d5219aa3c55c5cb1ed2c0b1a665ef2ad10da425c
YuriiMotovhttps://github.com/YuriiMotov
Problem with relationship in SQLmodel and fastapi #382https://github.com/fastapi/sqlmodel/issues/382
on Aug 7, 2025https://github.com/fastapi/sqlmodel/issues/315#event-19042551922
Sign up for freehttps://github.com/signup?return_to=https://github.com/fastapi/sqlmodel/issues/315
Sign in to commenthttps://github.com/login?return_to=https://github.com/fastapi/sqlmodel/issues/315
answeredhttps://github.com/fastapi/sqlmodel/issues?q=state%3Aopen%20label%3A%22answered%22
bugSomething isn't workinghttps://github.com/fastapi/sqlmodel/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.