[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-2607":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":33,"readmeContent":34,"aiSummary":35,"trendingCount":16,"starSnapshotCount":16,"syncStatus":36,"lastSyncTime":37,"discoverSource":38},2607,"sqlmodel","fastapi\u002Fsqlmodel","fastapi","SQL databases in Python, designed for simplicity, compatibility, and robustness.","https:\u002F\u002Fsqlmodel.tiangolo.com\u002F",null,"Python",18085,867,130,1,0,37,80,163,145,43.82,"MIT License",false,"main",true,[7,27,28,29,30,31,32],"json","json-schema","pydantic","python","sql","sqlalchemy","2026-06-12 02:00:42","\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fsqlmodel.tiangolo.com\">\u003Cimg src=\"https:\u002F\u002Fsqlmodel.tiangolo.com\u002Fimg\u002Flogo-margin\u002Flogo-margin-vector.svg#only-light\" alt=\"SQLModel\">\u003C\u002Fa>\n\n\u003C\u002Fp>\n\u003Cp align=\"center\">\n    \u003Cem>SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.\u003C\u002Fem>\n\u003C\u002Fp>\n\u003Cp align=\"center\">\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ffastapi\u002Fsqlmodel\u002Factions?query=workflow%3ATest+event%3Apush+branch%3Amain\" target=\"_blank\">\n    \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Ffastapi\u002Fsqlmodel\u002Factions\u002Fworkflows\u002Ftest.yml\u002Fbadge.svg?event=push&branch=main\" alt=\"Test\">\n\u003C\u002Fa>\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ffastapi\u002Fsqlmodel\u002Factions?query=workflow%3APublish\" target=\"_blank\">\n    \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Ffastapi\u002Fsqlmodel\u002Factions\u002Fworkflows\u002Fpublish.yml\u002Fbadge.svg\" alt=\"Publish\">\n\u003C\u002Fa>\n\u003Ca href=\"https:\u002F\u002Fcoverage-badge.samuelcolvin.workers.dev\u002Fredirect\u002Ffastapi\u002Fsqlmodel\" target=\"_blank\">\n    \u003Cimg src=\"https:\u002F\u002Fcoverage-badge.samuelcolvin.workers.dev\u002Ffastapi\u002Fsqlmodel.svg\" alt=\"Coverage\">\n\u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fsqlmodel\" target=\"_blank\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fsqlmodel?color=%2334D058&label=pypi%20package\" alt=\"Package version\">\n\u003C\u002Fa>\n\u003C\u002Fp>\n\n---\n\n**Documentation**: \u003Ca href=\"https:\u002F\u002Fsqlmodel.tiangolo.com\" target=\"_blank\">https:\u002F\u002Fsqlmodel.tiangolo.com\u003C\u002Fa>\n\n**Source Code**: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ffastapi\u002Fsqlmodel\" target=\"_blank\">https:\u002F\u002Fgithub.com\u002Ffastapi\u002Fsqlmodel\u003C\u002Fa>\n\n---\n\nSQLModel is a library for interacting with \u003Cabbr title='Also called \"Relational databases\"'>SQL databases\u003C\u002Fabbr> from Python code, with Python objects. It is designed to be intuitive, easy to use, highly compatible, and robust.\n\n**SQLModel** is based on Python type annotations, and powered by \u003Ca href=\"https:\u002F\u002Fpydantic-docs.helpmanual.io\u002F\" class=\"external-link\" target=\"_blank\">Pydantic\u003C\u002Fa> and \u003Ca href=\"https:\u002F\u002Fsqlalchemy.org\u002F\" class=\"external-link\" target=\"_blank\">SQLAlchemy\u003C\u002Fa>.\n\nThe key features are:\n\n* **Intuitive to write**: Great editor support. \u003Cabbr title=\"also known as auto-complete, autocompletion, IntelliSense\">Completion\u003C\u002Fabbr> everywhere. Less time debugging. Designed to be easy to use and learn. Less time reading docs.\n* **Easy to use**: It has sensible defaults and does a lot of work underneath to simplify the code you write.\n* **Compatible**: It is designed to be compatible with **FastAPI**, Pydantic, and SQLAlchemy.\n* **Extensible**: You have all the power of SQLAlchemy and Pydantic underneath.\n* **Short**: Minimize code duplication. A single type annotation does a lot of work. No need to duplicate models in SQLAlchemy and Pydantic.\n\n## Sponsors\n\n\u003C!-- sponsors -->\n\n\u003Ca href=\"https:\u002F\u002Fwww.govcert.lu\" target=\"_blank\" title=\"This project is being supported by GOVCERT.LU\">\u003Cimg src=\"https:\u002F\u002Fsqlmodel.tiangolo.com\u002Fimg\u002Fsponsors\u002Fgovcert.png\">\u003C\u002Fa>\n\n\u003C!-- \u002Fsponsors -->\n\n## SQL Databases in FastAPI\n\n\u003Ca href=\"https:\u002F\u002Ffastapi.tiangolo.com\" target=\"_blank\">\u003Cimg src=\"https:\u002F\u002Ffastapi.tiangolo.com\u002Fimg\u002Flogo-margin\u002Flogo-teal.png\" style=\"width: 20%;\">\u003C\u002Fa>\n\n**SQLModel** is designed to simplify interacting with SQL databases in \u003Ca href=\"https:\u002F\u002Ffastapi.tiangolo.com\" class=\"external-link\" target=\"_blank\">FastAPI\u003C\u002Fa> applications, it was created by the same \u003Ca href=\"https:\u002F\u002Ftiangolo.com\u002F\" class=\"external-link\" target=\"_blank\">author\u003C\u002Fa>. 😁\n\nIt combines SQLAlchemy and Pydantic and tries to simplify the code you write as much as possible, allowing you to reduce the **code duplication to a minimum**, but while getting the **best developer experience** possible.\n\n**SQLModel** is, in fact, a thin layer on top of **Pydantic** and **SQLAlchemy**, carefully designed to be compatible with both.\n\n## Requirements\n\nA recent and currently supported \u003Ca href=\"https:\u002F\u002Fwww.python.org\u002Fdownloads\u002F\" class=\"external-link\" target=\"_blank\">version of Python\u003C\u002Fa>.\n\nAs **SQLModel** is based on **Pydantic** and **SQLAlchemy**, it requires them. They will be automatically installed when you install SQLModel.\n\n## Installation\n\nMake sure you create a \u003Ca href=\"https:\u002F\u002Fsqlmodel.tiangolo.com\u002Fvirtual-environments\u002F\" class=\"external-link\" target=\"_blank\">virtual environment\u003C\u002Fa>, activate it, and then install SQLModel, for example with:\n\n\u003Cdiv class=\"termy\">\n\n```console\n$ pip install sqlmodel\n---> 100%\nSuccessfully installed sqlmodel\n```\n\n\u003C\u002Fdiv>\n\n## Example\n\nFor an introduction to databases, SQL, and everything else, see the \u003Ca href=\"https:\u002F\u002Fsqlmodel.tiangolo.com\u002Fdatabases\u002F\" target=\"_blank\">SQLModel documentation\u003C\u002Fa>.\n\nHere's a quick example. ✨\n\n### A SQL Table\n\nImagine you have a SQL table called `hero` with:\n\n* `id`\n* `name`\n* `secret_name`\n* `age`\n\nAnd you want it to have this data:\n\n| id | name | secret_name | age |\n-----|------|-------------|------|\n| 1  | Deadpond | Dive Wilson | null |\n| 2  | Spider-Boy | Pedro Parqueador | null |\n| 3  | Rusty-Man | Tommy Sharp | 48 |\n\n### Create a SQLModel Model\n\nThen you could create a **SQLModel** model like this:\n\n```Python\nfrom sqlmodel import Field, SQLModel\n\n\nclass Hero(SQLModel, table=True):\n    id: int | None = Field(default=None, primary_key=True)\n    name: str\n    secret_name: str\n    age: int | None = None\n```\n\nThat class `Hero` is a **SQLModel** model, the equivalent of a SQL table in Python code.\n\nAnd each of those class attributes is equivalent to each **table column**.\n\n### Create Rows\n\nThen you could **create each row** of the table as an **instance** of the model:\n\n```Python\nhero_1 = Hero(name=\"Deadpond\", secret_name=\"Dive Wilson\")\nhero_2 = Hero(name=\"Spider-Boy\", secret_name=\"Pedro Parqueador\")\nhero_3 = Hero(name=\"Rusty-Man\", secret_name=\"Tommy Sharp\", age=48)\n```\n\nThis way, you can use conventional Python code with **classes** and **instances** that represent **tables** and **rows**, and that way communicate with the **SQL database**.\n\n### Editor Support\n\nEverything is designed for you to get the best developer experience possible, with the best editor support.\n\nIncluding **autocompletion**:\n\n\u003Cimg class=\"shadow\" src=\"https:\u002F\u002Fsqlmodel.tiangolo.com\u002Fimg\u002Findex\u002Fautocompletion01.png\">\n\nAnd **inline errors**:\n\n\u003Cimg class=\"shadow\" src=\"https:\u002F\u002Fsqlmodel.tiangolo.com\u002Fimg\u002Findex\u002Finline-errors01.png\">\n\n### Write to the Database\n\nYou can learn a lot more about **SQLModel** by quickly following the **tutorial**, but if you need a taste right now of how to put all that together and save to the database, you can do this:\n\n```Python hl_lines=\"16  19  21-25\"\nfrom sqlmodel import Field, Session, SQLModel, create_engine\n\n\nclass Hero(SQLModel, table=True):\n    id: int | None = Field(default=None, primary_key=True)\n    name: str\n    secret_name: str\n    age: int | None = None\n\n\nhero_1 = Hero(name=\"Deadpond\", secret_name=\"Dive Wilson\")\nhero_2 = Hero(name=\"Spider-Boy\", secret_name=\"Pedro Parqueador\")\nhero_3 = Hero(name=\"Rusty-Man\", secret_name=\"Tommy Sharp\", age=48)\n\n\nengine = create_engine(\"sqlite:\u002F\u002F\u002Fdatabase.db\")\n\n\nSQLModel.metadata.create_all(engine)\n\nwith Session(engine) as session:\n    session.add(hero_1)\n    session.add(hero_2)\n    session.add(hero_3)\n    session.commit()\n```\n\nThat will save a **SQLite** database with the 3 heroes.\n\n### Select from the Database\n\nThen you could write queries to select from that same database, for example with:\n\n```Python hl_lines=\"13-17\"\nfrom sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Hero(SQLModel, table=True):\n    id: int | None = Field(default=None, primary_key=True)\n    name: str\n    secret_name: str\n    age: int | None = None\n\n\nengine = create_engine(\"sqlite:\u002F\u002F\u002Fdatabase.db\")\n\nwith Session(engine) as session:\n    statement = select(Hero).where(Hero.name == \"Spider-Boy\")\n    hero = session.exec(statement).first()\n    print(hero)\n```\n\n### Editor Support Everywhere\n\n**SQLModel** was carefully designed to give you the best developer experience and editor support, **even after selecting data** from the database:\n\n\u003Cimg class=\"shadow\" src=\"https:\u002F\u002Fsqlmodel.tiangolo.com\u002Fimg\u002Findex\u002Fautocompletion02.png\">\n\n## SQLAlchemy and Pydantic\n\nThat class `Hero` is a **SQLModel** model.\n\nBut at the same time, ✨ it is a **SQLAlchemy** model ✨. So, you can combine it and use it with other SQLAlchemy models, or you could easily migrate applications with SQLAlchemy to **SQLModel**.\n\nAnd at the same time, ✨ it is also a **Pydantic** model ✨. You can use inheritance with it to define all your **data models** while avoiding code duplication. That makes it very easy to use with **FastAPI**.\n\n## License\n\nThis project is licensed under the terms of the [MIT license](https:\u002F\u002Fgithub.com\u002Ffastapi\u002Fsqlmodel\u002Fblob\u002Fmain\u002FLICENSE).\n","SQLModel 是一个用于在 Python 中与 SQL 数据库交互的库，旨在提供简单、兼容和健壮的数据处理方案。它基于 Python 类型注解，并由 Pydantic 和 SQLAlchemy 提供支持，使得数据模型定义直观且易于使用。其核心功能包括智能编辑器支持、自动完成、默认设置合理以及与 FastAPI、Pydantic 和 SQLAlchemy 的良好兼容性。此外，SQLModel 通过减少代码冗余来提高开发效率，允许开发者在一个地方定义模型即可满足多种需求。此项目非常适合需要快速构建高效且易于维护的数据库驱动应用的场景，特别是在使用 FastAPI 构建 RESTful API 或者 Web 应用时。",2,"2026-06-11 02:50:30","top_language"]