René's URL Explorer Experiment


Title: TypeError: issubclass() arg 1 must be a class when having a field with a complex type · Issue #67 · fastapi/sqlmodel · GitHub

Open Graph Title: TypeError: issubclass() arg 1 must be a class when having a field with a complex type · Issue #67 · fastapi/sqlmodel

X Title: TypeError: issubclass() arg 1 must be a class when having a field with a complex type · Issue #67 · 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/67

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TypeError: issubclass() arg 1 must be a class when having a field with a complex type","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 datetime import datetime\r\nfrom typing import Optional, List, Tuple, Dict, Union\r\nfrom sqlmodel import Field, SQLModel, create_engine\r\n\r\nclass SemanticSearch(SQLModel, table=True):\r\n    id: Optional[int] = Field(default=None, primary_key=True)\r\n    id_user: int\r\n    date_time: datetime\r\n    query: str\r\n    clean_query: str\r\n    semantic_search_result: List[Tuple[int, Dict[str, Union[str, int, float]]]]\r\n\r\n## sqlite\r\nsqlite_file_name = \"database.db\"\r\nsqlite_url = f\"sqlite:///{sqlite_file_name}\"\r\n\r\nengine = create_engine(sqlite_url, echo=True)\r\n\r\nSQLModel.metadata.create_all(engine)\r\n```\r\n\r\n\r\n### Description\r\n\r\nI would like to create a `semantic_search` table in the `database.db` sqlite database with the 6 fields specified.\r\n\r\nThe last field `semantic_search_result` with `List[Tuple[int, Dict[str, Union[str, int, float]]]]` type seems to cause the error.\r\n\r\n`semantic_search_result` looks like this for example:\r\n```\r\n[\r\n   (0, { \"acquisCode\": str, \"code\": str, \"level\": int, \"title\": str, \"similarity_score\": float}),\r\n   (1, { \"acquisCode\": str, \"code\": str, \"level\": int, \"title\": str, \"similarity_score\": float}),\r\n   (2, { \"acquisCode\": str, \"code\": str, \"level\": int, \"title\": str, \"similarity_score\": float})\r\n]\r\n```\r\nWhen running the code I got the following error:\r\n```\r\nTraceback (most recent call last):\r\n  File \"/home/matthieu/Code/Python/fastapi-graphql/test_SQLModel.py\", line 6, in \u003cmodule>\r\n    class SemanticSearch(SQLModel, table=True):\r\n  File \"/home/matthieu/anaconda3/envs/sts-transformers-gpu-fresh/lib/python3.8/site-packages/sqlmodel/main.py\", line 292, in __new__\r\n    col = get_column_from_field(v)\r\n  File \"/home/matthieu/anaconda3/envs/sts-transformers-gpu-fresh/lib/python3.8/site-packages/sqlmodel/main.py\", line 415, in get_column_from_field\r\n    sa_type = get_sqlachemy_type(field)\r\n  File \"/home/matthieu/anaconda3/envs/sts-transformers-gpu-fresh/lib/python3.8/site-packages/sqlmodel/main.py\", line 373, in get_sqlachemy_type\r\n    if issubclass(field.type_, str):\r\nTypeError: issubclass() arg 1 must be a class\r\n```\r\nI got the same error if I tried to define a subclass of the `typing_extensions.TypedDict` class:\r\n```\r\nclass SemanticSearchDict(TypedDict):\r\n    acquis_code: str\r\n    code: str\r\n    level: int\r\n    title: str\r\n    similarity_score: float\r\n\r\nclass SemanticSearch(SQLModel, table=True):\r\n    id: Optional[int] = Field(default=None, primary_key=True)\r\n    id_user: int\r\n    date_time: datetime\r\n    query: str\r\n    clean_query: str\r\n    semantic_search_result: List[Tuple[int, SemanticSearchDict]]\r\n```\r\nI couldn't find a solution but #57 seems to have the same problem since having the same error.\r\n\r\n### Operating System\r\n\r\nLinux\r\n\r\n### Operating System Details\r\n\r\nUbuntu 18.04 LTS\r\n\r\n### SQLModel Version\r\n\r\n0.0.4\r\n\r\n### Python Version\r\n\r\n3.8.8\r\n\r\n### Additional Context\r\n\r\n_No response_","author":{"url":"https://github.com/Matthieu-Tinycoaching","@type":"Person","name":"Matthieu-Tinycoaching"},"datePublished":"2021-09-01T11:56:18Z","url":"https://github.com/fastapi/sqlmodel/issues/67"}

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:a6a89a1a-f8a7-b745-3a90-66f91daccfba
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idACEE:3BE529:7720FF:A38598:6AFDEF78
html-safe-nonce11871150704a1722445df182f5f962a42a7e84a17be3ed7360be2dc483fe23cb
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQ0VFOjNCRTUyOTo3NzIwRkY6QTM4NTk4OjZBRkRFRjc4IiwidmlzaXRvcl9pZCI6IjIxNTkwNTQzMDAyODAzODU0MDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmace8f01aa3982a4a9572c3d91df1ad17732dbff10849f677c09cd857405874403d
hovercard-subject-tagissue:985059294
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/67/issue_layout
twitter:imagehttps://opengraph.githubassets.com/610b14eba1585cac32bcf0a9c7a5c72f36fea0d8d1c00f5130123884e065ada9/fastapi/sqlmodel/issues/67
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/610b14eba1585cac32bcf0a9c7a5c72f36fea0d8d1c00f5130123884e065ada9/fastapi/sqlmodel/issues/67
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:usernameMatthieu-Tinycoaching
hostnamegithub.com
expected-hostnamegithub.com
Nonedd812ec581ecac95855f5ec917ef9827506c39a9da1443f43ddb4179a46471eb
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
release32ac708bac264dafdc28e10ff49b4d137f0c34a7
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/fastapi/sqlmodel/issues/67#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffastapi%2Fsqlmodel%2Fissues%2F67
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%2F67
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/67
Reloadhttps://github.com/fastapi/sqlmodel/issues/67
Reloadhttps://github.com/fastapi/sqlmodel/issues/67
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/67
New issuehttps://github.com/login?return_to=https://github.com/fastapi/sqlmodel/issues/67
TypeError: issubclass() arg 1 must be a class when having a field with a complex typehttps://github.com/fastapi/sqlmodel/issues/67#top
questionFurther information is requestedhttps://github.com/fastapi/sqlmodel/issues?q=state%3Aopen%20label%3A%22question%22
https://github.com/Matthieu-Tinycoaching
Matthieu-Tinycoachinghttps://github.com/Matthieu-Tinycoaching
on Sep 1, 2021https://github.com/fastapi/sqlmodel/issues/67#issue-985059294
Pydantichttps://github.com/samuelcolvin/pydantic
SQLAlchemyhttps://github.com/sqlalchemy/sqlalchemy
#57https://github.com/fastapi/sqlmodel/issues/57
Matthieu-Tinycoachinghttps://github.com/Matthieu-Tinycoaching
questionFurther information is requestedhttps://github.com/fastapi/sqlmodel/issues?q=state%3Aopen%20label%3A%22question%22
on Sep 1, 2021https://github.com/fastapi/sqlmodel/issues/67#event-5239038957
https://github.com/ademoverflow
ademoverflowhttps://github.com/ademoverflow
on Sep 7, 2021https://github.com/fastapi/sqlmodel/issues/67#issuecomment-914364420
https://github.com/Matthieu-Tinycoaching
Matthieu-Tinycoachinghttps://github.com/Matthieu-Tinycoaching
on Oct 13, 2021https://github.com/fastapi/sqlmodel/issues/67#issuecomment-942723112
https://github.com/lobotmcj
lobotmcjhttps://github.com/lobotmcj
on Oct 18, 2021https://github.com/fastapi/sqlmodel/issues/67#issuecomment-946188994
#121https://github.com/fastapi/sqlmodel/issues/121
https://github.com/bjoernh
bjoernhhttps://github.com/bjoernh
on Nov 15, 2021https://github.com/fastapi/sqlmodel/issues/67#issuecomment-968907148
https://github.com/txemac
txemachttps://github.com/txemac
on Apr 23, 2022https://github.com/fastapi/sqlmodel/issues/67#issuecomment-1107449710
https://github.com/data-djinn
data-djinnhttps://github.com/data-djinn
on Jun 15, 2022https://github.com/fastapi/sqlmodel/issues/67#issuecomment-1155880582
https://github.com/memark
memarkhttps://github.com/memark
on Apr 29, 2023https://github.com/fastapi/sqlmodel/issues/67#issuecomment-1528793090
https://github.com/SPablo2191
SPablo2191https://github.com/SPablo2191
on May 14, 2024https://github.com/fastapi/sqlmodel/issues/67#issuecomment-2110449137
https://github.com/ShravanSunder
ShravanSunderhttps://github.com/ShravanSunder
on Jun 13, 2024https://github.com/fastapi/sqlmodel/issues/67#issuecomment-2165771821
https://private-user-images.githubusercontent.com/5294949/339393501-69da254d-7ec5-4f9b-9a2c-4d8a1429bbea.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTUwMjcxMDksIm5iZiI6MTc5NTAyNjgwOSwicGF0aCI6Ii81Mjk0OTQ5LzMzOTM5MzUwMS02OWRhMjU0ZC03ZWM1LTRmOWItOWEyYy00ZDhhMTQyOWJiZWEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MTExOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjExMThUMTgzMzI5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NjNlZjhmMzRkNzZjYjJjYmU5N2NkYmNhYmQyMWEwNTQ1YzY5NWQ3ZDEzNjFhY2ZmYWZmNzYyNjZkZTY0ZWE2MiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.ndlGOefBbtaVoKm7y1B-3SIqfK5ehdVh_KY9jNA6VLg
https://github.com/YuriiMotov
YuriiMotovhttps://github.com/YuriiMotov
on Aug 15, 2025https://github.com/fastapi/sqlmodel/issues/67#issuecomment-3190787464
fastapihttps://github.com/fastapi
on Aug 15, 2025https://github.com/fastapi/sqlmodel/issues/67#event-19172078350
YuriiMotovhttps://github.com/YuriiMotov
#1522 https://github.com/fastapi/sqlmodel/discussions/1522
on Aug 15, 2025https://github.com/fastapi/sqlmodel/issues/67#event-19172078377
Sign up for freehttps://github.com/signup?return_to=https://github.com/fastapi/sqlmodel/issues/67
Sign in to commenthttps://github.com/login?return_to=https://github.com/fastapi/sqlmodel/issues/67
questionFurther information is requestedhttps://github.com/fastapi/sqlmodel/issues?q=state%3Aopen%20label%3A%22question%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.