René's URL Explorer Experiment


Title: parse_obj return type is SQLModel · Issue #317 · fastapi/sqlmodel · GitHub

Open Graph Title: parse_obj return type is SQLModel · Issue #317 · fastapi/sqlmodel

X Title: parse_obj return type is SQLModel · Issue #317 · 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/317

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"parse_obj return type is SQLModel","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### 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 sqlmodel import SQLModel\r\n\r\nclass test(SQLModel):\r\n    attr: int\r\n    desc: str\r\n\r\nclass real(test, table=True):\r\n    val: float\r\n\r\ntest_inst: test = test(attr=1, desc='test_inst')\r\nreal_inst: real = real.parse_obj(test_inst.dict())\r\n\"\"\"\r\n(method) parse_obj: (obj: Any, update: Dict[str, Any] | None = None) -> SQLModel\r\nExpression of type \"SQLModel\" cannot be assigned to declared type \"real\"\r\n  \"SQLModel\" is incompatible with \"real\"PylancereportGeneralTypeIssues\r\n\"\"\"\r\n```\r\n\r\n\r\n### Description\r\n\r\nreal.parse_obj return type should be real.\r\n\r\n### Wanted Solution\r\n\r\n```python\r\n# sqlmodel/main.py\r\n\r\nfrom typing import TypeVar\r\n_T = TypeVar(\"_T\", bound=\"SQLModel\")\r\n\r\n(...)\r\n\r\n# line no.569\r\n    @classmethod\r\n    def parse_obj(\r\n        cls: Type[_T], obj: Any, update: Optional[Dict[str, Any]] = None\r\n    ) -> _T:\r\n        obj = cls._enforce_dict_if_root(obj)\r\n        # SQLModel, support update dict\r\n        if update is not None:\r\n            obj = {**obj, **update}\r\n        # End SQLModel support dict\r\n        return super().parse_obj(obj)\r\n```\r\n\r\n### Wanted Code\r\n\r\n...\r\n\r\n\r\n### Alternatives\r\n\r\nIt's being used temporarily like this.\r\n\r\n```python\r\nfrom typing import Any, TypeVar, cast\r\n\r\nfrom sqlmodel import SQLModel\r\n\r\n_T = TypeVar(\"_T\", bound=SQLModel)\r\n\r\n\r\nclass fix_parse_obj_model(SQLModel):\r\n    @classmethod\r\n    def parse_obj(cls: type[_T], obj: Any, update: dict[str, Any] | None = None) -> _T:\r\n        return cast(_T, super().parse_obj(obj, update))\r\n```\r\n\r\n### Operating System\r\n\r\nLinux\r\n\r\n### Operating System Details\r\n\r\nOS: Arch Linux x86_64 \r\nHost: 82FX Yoga Slim 7 Pro 14ITL5 \r\nKernel: 5.17.4-arch1-1 \r\nUptime: 3 hours, 32 mins \r\nPackages: 969 (pacman), 23 (flatpak) \r\nShell: zsh 5.8.1 \r\nResolution: 2240x1400, 2560x1080 \r\nDE: GNOME 42.0 \r\nWM: Mutter \r\nWM Theme: Adwaita \r\nTheme: Arc [GTK2/3] \r\nIcons: Papirus [GTK2/3] \r\nTerminal: vscode \r\nCPU: 11th Gen Intel i5-1135G7 (8) @ 4.200GHz \r\nGPU: Intel TigerLake-LP GT2 [Iris Xe Graphics] \r\nGPU: NVIDIA GeForce MX450 \r\nMemory: 5423MiB / 15785MiB\r\n\r\n### SQLModel Version\r\n\r\n0.0.6\r\n\r\n### Python Version\r\n\r\nPython 3.10.4\r\n\r\n### Additional Context\r\n\r\nI'd like to do a \"pull requests\"\r\nshame I'm not used to git yet...","author":{"url":"https://github.com/phi-friday","@type":"Person","name":"phi-friday"},"datePublished":"2022-04-28T13:14:49Z","url":"https://github.com/fastapi/sqlmodel/issues/317"}

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:2aca1597-5057-200e-a92a-8e58143c236c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB1EC:2A1761:1713D2:1FCBC9:6AFE0544
html-safe-noncea4379a65f0955ec3128f9940d5630ac439582cf2788ccfe674177c5b342adf62
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMUVDOjJBMTc2MToxNzEzRDI6MUZDQkM5OjZBRkUwNTQ0IiwidmlzaXRvcl9pZCI6IjY1NjQxODUzNzI4MjQwNDQ4NjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac74a01019296353a5a9b72b4e1c8c04014278c7a66d9d5da06fc69ee623850553
hovercard-subject-tagissue:1218714249
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/317/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2dfd2f074964a02da7a488a95e8e630438c39cd211bfa8ce86d9061531f4c1af/fastapi/sqlmodel/issues/317
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2dfd2f074964a02da7a488a95e8e630438c39cd211bfa8ce86d9061531f4c1af/fastapi/sqlmodel/issues/317
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:usernamephi-friday
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/317#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffastapi%2Fsqlmodel%2Fissues%2F317
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%2F317
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/317
Reloadhttps://github.com/fastapi/sqlmodel/issues/317
Reloadhttps://github.com/fastapi/sqlmodel/issues/317
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/317
New issuehttps://github.com/login?return_to=https://github.com/fastapi/sqlmodel/issues/317
parse_obj return type is SQLModelhttps://github.com/fastapi/sqlmodel/issues/317#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/phi-friday
phi-fridayhttps://github.com/phi-friday
on Apr 28, 2022https://github.com/fastapi/sqlmodel/issues/317#issue-1218714249
Pydantichttps://github.com/samuelcolvin/pydantic
SQLAlchemyhttps://github.com/sqlalchemy/sqlalchemy
phi-fridayhttps://github.com/phi-friday
featureNew feature or requesthttps://github.com/fastapi/sqlmodel/issues?q=state%3Aopen%20label%3A%22feature%22
on Apr 28, 2022https://github.com/fastapi/sqlmodel/issues/317#event-6515051662
https://github.com/antont
antonthttps://github.com/antont
on Apr 28, 2022https://github.com/fastapi/sqlmodel/issues/317#issuecomment-1112708090
https://github.com/phi-friday
phi-fridayhttps://github.com/phi-friday
on Apr 29, 2022https://github.com/fastapi/sqlmodel/issues/317#issuecomment-1113327747
@antonthttps://github.com/antont
phi-fridayhttps://github.com/phi-friday
completedhttps://github.com/fastapi/sqlmodel/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Apr 29, 2022https://github.com/fastapi/sqlmodel/issues/317#event-6523458686
phi-fridayhttps://github.com/phi-friday
on Apr 29, 2022https://github.com/fastapi/sqlmodel/issues/317#event-6523513953
fix parse_obj, validate method return typehttps://github.com/phi-friday/sqlmodel/commit/06df293f6c5701890edba1c5d9e21ce06a37d61b
06df293https://github.com/phi-friday/sqlmodel/commit/06df293f6c5701890edba1c5d9e21ce06a37d61b
https://github.com/tiangolo
tiangolohttps://github.com/tiangolo
on Aug 27, 2022https://github.com/fastapi/sqlmodel/issues/317#issuecomment-1229315246
@phi-fridayhttps://github.com/phi-friday
#321https://github.com/fastapi/sqlmodel/pull/321
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
featureNew feature or requesthttps://github.com/fastapi/sqlmodel/issues?q=state%3Aopen%20label%3A%22feature%22
on Aug 27, 2022https://github.com/fastapi/sqlmodel/issues/317#event-7272631293
Sign up for freehttps://github.com/signup?return_to=https://github.com/fastapi/sqlmodel/issues/317
Sign in to commenthttps://github.com/login?return_to=https://github.com/fastapi/sqlmodel/issues/317
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.