Full Code of fastapi/sqlmodel for AI

main b5492028af6e cached
434 files
1.2 MB
326.8k tokens
1008 symbols
1 requests
Download .txt
Showing preview only (1,392K chars total). Download the full file or copy to clipboard to get everything.
Repository: fastapi/sqlmodel
Branch: main
Commit: b5492028af6e
Files: 434
Total size: 1.2 MB

Directory structure:
gitextract_v2ezreog/

├── .github/
│   ├── DISCUSSION_TEMPLATE/
│   │   └── questions.yml
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE/
│   │   ├── config.yml
│   │   └── privileged.yml
│   ├── dependabot.yml
│   ├── labeler.yml
│   └── workflows/
│       ├── add-to-project.yml
│       ├── build-docs.yml
│       ├── deploy-docs.yml
│       ├── detect-conflicts.yml
│       ├── issue-manager.yml
│       ├── labeler.yml
│       ├── latest-changes.yml
│       ├── pre-commit.yml
│       ├── publish.yml
│       ├── smokeshow.yml
│       ├── test-redistribute.yml
│       └── test.yml
├── .gitignore
├── .pre-commit-config.yaml
├── .python-version
├── CITATION.cff
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── data/
│   ├── members.yml
│   └── sponsors.yml
├── docs/
│   ├── about/
│   │   └── index.md
│   ├── advanced/
│   │   ├── decimal.md
│   │   ├── index.md
│   │   └── uuid.md
│   ├── alternatives.md
│   ├── contributing.md
│   ├── css/
│   │   ├── custom.css
│   │   └── termynal.css
│   ├── databases.md
│   ├── db-to-code.md
│   ├── environment-variables.md
│   ├── features.md
│   ├── help.md
│   ├── index.md
│   ├── install.md
│   ├── js/
│   │   ├── custom.js
│   │   └── termynal.js
│   ├── learn/
│   │   └── index.md
│   ├── management-tasks.md
│   ├── management.md
│   ├── overrides/
│   │   └── main.html
│   ├── release-notes.md
│   ├── resources/
│   │   └── index.md
│   ├── tutorial/
│   │   ├── automatic-id-none-refresh.md
│   │   ├── code-structure.md
│   │   ├── connect/
│   │   │   ├── create-connected-rows.md
│   │   │   ├── create-connected-tables.md
│   │   │   ├── index.md
│   │   │   ├── read-connected-data.md
│   │   │   ├── remove-data-connections.md
│   │   │   └── update-data-connections.md
│   │   ├── create-db-and-table-with-db-browser.md
│   │   ├── create-db-and-table.md
│   │   ├── delete.md
│   │   ├── fastapi/
│   │   │   ├── delete.md
│   │   │   ├── index.md
│   │   │   ├── limit-and-offset.md
│   │   │   ├── multiple-models.md
│   │   │   ├── read-one.md
│   │   │   ├── relationships.md
│   │   │   ├── response-model.md
│   │   │   ├── session-with-dependency.md
│   │   │   ├── simple-hero-api.md
│   │   │   ├── teams.md
│   │   │   ├── tests.md
│   │   │   ├── update-extra-data.md
│   │   │   └── update.md
│   │   ├── index.md
│   │   ├── indexes.md
│   │   ├── insert.md
│   │   ├── limit-and-offset.md
│   │   ├── many-to-many/
│   │   │   ├── create-data.md
│   │   │   ├── create-models-with-link.md
│   │   │   ├── index.md
│   │   │   ├── link-with-extra-fields.md
│   │   │   └── update-remove-relationships.md
│   │   ├── one.md
│   │   ├── relationship-attributes/
│   │   │   ├── back-populates.md
│   │   │   ├── cascade-delete-relationships.md
│   │   │   ├── create-and-update-relationships.md
│   │   │   ├── define-relationships-attributes.md
│   │   │   ├── index.md
│   │   │   ├── read-relationships.md
│   │   │   ├── remove-relationships.md
│   │   │   └── type-annotation-strings.md
│   │   ├── select.md
│   │   ├── update.md
│   │   └── where.md
│   └── virtual-environments.md
├── docs_src/
│   ├── __init__.py
│   ├── advanced/
│   │   ├── __init__.py
│   │   ├── decimal/
│   │   │   ├── __init__.py
│   │   │   └── tutorial001_py310.py
│   │   └── uuid/
│   │       ├── __init__.py
│   │       ├── tutorial001_py310.py
│   │       └── tutorial002_py310.py
│   └── tutorial/
│       ├── __init__.py
│       ├── automatic_id_none_refresh/
│       │   ├── __init__.py
│       │   ├── annotations/
│       │   │   └── en/
│       │   │       └── tutorial002.md
│       │   ├── tutorial001_py310.py
│       │   └── tutorial002_py310.py
│       ├── code_structure/
│       │   ├── __init__.py
│       │   ├── tutorial001_py310/
│       │   │   ├── __init__.py
│       │   │   ├── app.py
│       │   │   ├── database.py
│       │   │   └── models.py
│       │   └── tutorial002_py310/
│       │       ├── __init__.py
│       │       ├── app.py
│       │       ├── database.py
│       │       ├── hero_model.py
│       │       └── team_model.py
│       ├── connect/
│       │   ├── __init__.py
│       │   ├── create_tables/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── delete/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── insert/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── select/
│       │   │   ├── __init__.py
│       │   │   ├── tutorial001_py310.py
│       │   │   ├── tutorial002_py310.py
│       │   │   ├── tutorial003_py310.py
│       │   │   ├── tutorial004_py310.py
│       │   │   └── tutorial005_py310.py
│       │   └── update/
│       │       ├── __init__.py
│       │       └── tutorial001_py310.py
│       ├── create_db_and_table/
│       │   ├── __init__.py
│       │   ├── annotations/
│       │   │   └── en/
│       │   │       └── tutorial003.md
│       │   ├── tutorial001_py310.py
│       │   ├── tutorial002_py310.py
│       │   └── tutorial003_py310.py
│       ├── delete/
│       │   ├── __init__.py
│       │   ├── annotations/
│       │   │   └── en/
│       │   │       └── tutorial002.md
│       │   ├── tutorial001_py310.py
│       │   └── tutorial002_py310.py
│       ├── fastapi/
│       │   ├── __init__.py
│       │   ├── app_testing/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310/
│       │   │       ├── __init__.py
│       │   │       ├── annotations/
│       │   │       │   └── en/
│       │   │       │       ├── test_main_001.md
│       │   │       │       ├── test_main_002.md
│       │   │       │       ├── test_main_003.md
│       │   │       │       ├── test_main_004.md
│       │   │       │       ├── test_main_005.md
│       │   │       │       └── test_main_006.md
│       │   │       ├── main.py
│       │   │       ├── test_extra_coverage.py
│       │   │       ├── test_main.py
│       │   │       ├── test_main_001.py
│       │   │       ├── test_main_002.py
│       │   │       ├── test_main_003.py
│       │   │       ├── test_main_004.py
│       │   │       ├── test_main_005.py
│       │   │       └── test_main_006.py
│       │   ├── delete/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── limit_and_offset/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── multiple_models/
│       │   │   ├── __init__.py
│       │   │   ├── tutorial001_py310.py
│       │   │   └── tutorial002_py310.py
│       │   ├── read_one/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── relationships/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── response_model/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── session_with_dependency/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── simple_hero_api/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── teams/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   └── update/
│       │       ├── __init__.py
│       │       ├── tutorial001_py310.py
│       │       └── tutorial002_py310.py
│       ├── indexes/
│       │   ├── __init__.py
│       │   ├── tutorial001_py310.py
│       │   └── tutorial002_py310.py
│       ├── insert/
│       │   ├── __init__.py
│       │   ├── annotations/
│       │   │   └── en/
│       │   │       └── tutorial003.md
│       │   ├── tutorial001_py310.py
│       │   ├── tutorial002_py310.py
│       │   └── tutorial003_py310.py
│       ├── many_to_many/
│       │   ├── __init__.py
│       │   ├── tutorial001_py310.py
│       │   ├── tutorial002_py310.py
│       │   └── tutorial003_py310.py
│       ├── offset_and_limit/
│       │   ├── __init__.py
│       │   ├── tutorial001_py310.py
│       │   ├── tutorial002_py310.py
│       │   ├── tutorial003_py310.py
│       │   └── tutorial004_py310.py
│       ├── one/
│       │   ├── __init__.py
│       │   ├── tutorial001_py310.py
│       │   ├── tutorial002_py310.py
│       │   ├── tutorial003_py310.py
│       │   ├── tutorial004_py310.py
│       │   ├── tutorial005_py310.py
│       │   ├── tutorial006_py310.py
│       │   ├── tutorial007_py310.py
│       │   ├── tutorial008_py310.py
│       │   └── tutorial009_py310.py
│       ├── relationship_attributes/
│       │   ├── __init__.py
│       │   ├── back_populates/
│       │   │   ├── __init__.py
│       │   │   ├── tutorial001_py310.py
│       │   │   ├── tutorial002_py310.py
│       │   │   └── tutorial003_py310.py
│       │   ├── cascade_delete_relationships/
│       │   │   ├── __init__.py
│       │   │   ├── tutorial001_py310.py
│       │   │   ├── tutorial002_py310.py
│       │   │   ├── tutorial003_py310.py
│       │   │   ├── tutorial004_py310.py
│       │   │   └── tutorial005_py310.py
│       │   ├── create_and_update_relationships/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── define_relationship_attributes/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   └── read_relationships/
│       │       ├── __init__.py
│       │       ├── tutorial001_py310.py
│       │       └── tutorial002_py310.py
│       ├── select/
│       │   ├── __init__.py
│       │   ├── annotations/
│       │   │   └── en/
│       │   │       └── tutorial002.md
│       │   ├── tutorial001_py310.py
│       │   ├── tutorial002_py310.py
│       │   ├── tutorial003_py310.py
│       │   └── tutorial004_py310.py
│       ├── update/
│       │   ├── __init__.py
│       │   ├── annotations/
│       │   │   └── en/
│       │   │       ├── tutorial002.md
│       │   │       └── tutorial004.md
│       │   ├── tutorial001_py310.py
│       │   ├── tutorial002_py310.py
│       │   ├── tutorial003_py310.py
│       │   └── tutorial004_py310.py
│       └── where/
│           ├── __init__.py
│           ├── tutorial001_py310.py
│           ├── tutorial002_py310.py
│           ├── tutorial003_py310.py
│           ├── tutorial004_py310.py
│           ├── tutorial005_py310.py
│           ├── tutorial006_py310.py
│           ├── tutorial006b_py310.py
│           ├── tutorial006b_py39.py
│           ├── tutorial007_py310.py
│           ├── tutorial008_py310.py
│           ├── tutorial009_py310.py
│           └── tutorial011_py310.py
├── mkdocs.env.yml
├── mkdocs.yml
├── pyproject.toml
├── scripts/
│   ├── deploy_docs_status.py
│   ├── docs.py
│   ├── format.sh
│   ├── generate_select.py
│   ├── lint.sh
│   ├── mkdocs_hooks.py
│   └── test.sh
├── sqlmodel/
│   ├── __init__.py
│   ├── _compat.py
│   ├── default.py
│   ├── ext/
│   │   ├── __init__.py
│   │   └── asyncio/
│   │       ├── __init__.py
│   │       └── session.py
│   ├── main.py
│   ├── orm/
│   │   ├── __init__.py
│   │   └── session.py
│   ├── pool/
│   │   └── __init__.py
│   ├── py.typed
│   └── sql/
│       ├── __init__.py
│       ├── _expression_select_cls.py
│       ├── _expression_select_gen.py
│       ├── _expression_select_gen.py.jinja2
│       ├── base.py
│       ├── expression.py
│       └── sqltypes.py
├── sqlmodel-slim/
│   └── README.md
└── tests/
    ├── __init__.py
    ├── conftest.py
    ├── test_advanced/
    │   ├── __init__.py
    │   ├── test_decimal/
    │   │   ├── __init__.py
    │   │   └── test_tutorial001.py
    │   └── test_uuid/
    │       ├── __init__.py
    │       ├── test_tutorial001.py
    │       └── test_tutorial002.py
    ├── test_aliases.py
    ├── test_annotated_uuid.py
    ├── test_default.py
    ├── test_deprecations.py
    ├── test_enums.py
    ├── test_enums_models.py
    ├── test_field_sa_args_kwargs.py
    ├── test_field_sa_column.py
    ├── test_field_sa_relationship.py
    ├── test_fields_set.py
    ├── test_future_annotations.py
    ├── test_instance_no_args.py
    ├── test_main.py
    ├── test_missing_type.py
    ├── test_nullable.py
    ├── test_ondelete_raises.py
    ├── test_pydantic/
    │   ├── __init__.py
    │   └── test_field.py
    ├── test_query.py
    ├── test_select_gen.py
    ├── test_select_typing.py
    ├── test_sqlalchemy_type_errors.py
    ├── test_tutorial/
    │   ├── __init__.py
    │   ├── test_automatic_id_none_refresh/
    │   │   ├── __init__.py
    │   │   └── test_tutorial001_tutorial002.py
    │   ├── test_code_structure/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001.py
    │   │   └── test_tutorial002.py
    │   ├── test_connect/
    │   │   ├── __init__.py
    │   │   ├── test_create_connected_tables/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_delete/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_insert/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_select/
    │   │   │   ├── __init__.py
    │   │   │   ├── test_tutorial001_tutorial002.py
    │   │   │   ├── test_tutorial003.py
    │   │   │   ├── test_tutorial004.py
    │   │   │   └── test_tutorial005.py
    │   │   └── test_update/
    │   │       ├── __init__.py
    │   │       └── test_tutorial001.py
    │   ├── test_create_db_and_table/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001.py
    │   │   ├── test_tutorial002.py
    │   │   └── test_tutorial003.py
    │   ├── test_delete/
    │   │   ├── __init__.py
    │   │   └── test_tutorial001_tutorial002.py
    │   ├── test_fastapi/
    │   │   ├── __init__.py
    │   │   ├── test_app_testing/
    │   │   │   ├── __init__.py
    │   │   │   ├── test_tutorial001_tests001.py
    │   │   │   ├── test_tutorial001_tests002.py
    │   │   │   ├── test_tutorial001_tests003.py
    │   │   │   ├── test_tutorial001_tests004.py
    │   │   │   ├── test_tutorial001_tests005.py
    │   │   │   ├── test_tutorial001_tests006.py
    │   │   │   └── test_tutorial001_tests_main.py
    │   │   ├── test_delete/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_limit_and_offset/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_multiple_models/
    │   │   │   ├── __init__.py
    │   │   │   ├── test_tutorial001.py
    │   │   │   └── test_tutorial002.py
    │   │   ├── test_read_one/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_relationships/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_response_model/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_session_with_dependency/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_simple_hero_api/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_teams/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   └── test_update/
    │   │       ├── __init__.py
    │   │       ├── test_tutorial001.py
    │   │       └── test_tutorial002.py
    │   ├── test_indexes/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001.py
    │   │   └── test_tutorial002.py
    │   ├── test_insert/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001.py
    │   │   ├── test_tutorial002.py
    │   │   └── test_tutorial003.py
    │   ├── test_limit_and_offset/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001.py
    │   │   ├── test_tutorial002.py
    │   │   ├── test_tutorial003.py
    │   │   └── test_tutorial004.py
    │   ├── test_many_to_many/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001.py
    │   │   ├── test_tutorial002.py
    │   │   └── test_tutorial003.py
    │   ├── test_one/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001.py
    │   │   ├── test_tutorial002.py
    │   │   ├── test_tutorial003.py
    │   │   ├── test_tutorial004.py
    │   │   ├── test_tutorial005.py
    │   │   ├── test_tutorial006.py
    │   │   ├── test_tutorial007.py
    │   │   ├── test_tutorial008.py
    │   │   └── test_tutorial009.py
    │   ├── test_relationship_attributes/
    │   │   ├── __init__.py
    │   │   ├── test_back_populates/
    │   │   │   ├── __init__.py
    │   │   │   ├── test_tutorial001.py
    │   │   │   ├── test_tutorial002.py
    │   │   │   └── test_tutorial003.py
    │   │   ├── test_create_and_update_relationships/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_define_relationship_attributes/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_delete_records_relationship/
    │   │   │   ├── __init__.py
    │   │   │   ├── test_tutorial001.py
    │   │   │   ├── test_tutorial002.py
    │   │   │   ├── test_tutorial003.py
    │   │   │   ├── test_tutorial004.py
    │   │   │   └── test_tutorial005.py
    │   │   └── test_read_relationships/
    │   │       ├── __init__.py
    │   │       ├── test_tutorial001.py
    │   │       └── test_tutorial002.py
    │   ├── test_select/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001_tutorial002.py
    │   │   └── test_tutorial003_tutorial004.py
    │   ├── test_update/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001_tutorial002.py
    │   │   └── test_tutorial003_tutorial004.py
    │   └── test_where/
    │       ├── __init__.py
    │       ├── test_tutorial001.py
    │       ├── test_tutorial002.py
    │       ├── test_tutorial003.py
    │       ├── test_tutorial004.py
    │       ├── test_tutorial005.py
    │       ├── test_tutorial006.py
    │       ├── test_tutorial006b.py
    │       ├── test_tutorial007.py
    │       ├── test_tutorial008.py
    │       ├── test_tutorial009.py
    │       └── test_tutorial011.py
    ├── test_update.py
    └── test_validation.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/DISCUSSION_TEMPLATE/questions.yml
================================================
labels: [question]
body:
  - type: markdown
    attributes:
      value: |
        Thanks for your interest in SQLModel! 🚀

        Please follow these instructions, fill every question, and do every step. 🙏

        I'm asking this because answering questions and solving problems in GitHub is what consumes most of the time.

        I end up not being able to add new features, fix bugs, review pull requests, etc. as fast as I wish because I have to spend too much time handling questions.

        All that, on top of all the incredible help provided by a bunch of community members that give a lot of their time to come here and help others.

        If more SQLModel users came to help others like them just a little bit more, it would be much less effort for them (and you and me 😅).

        By asking questions in a structured way (following this) it will be much easier to help you.

        And there's a high chance that you will find the solution along the way and you won't even have to submit it and wait for an answer. 😎

        As there are too many questions, I'll have to discard and close the incomplete ones. That will allow me (and others) to focus on helping people like you that follow the whole process and help us help you. 🤓
  - type: checkboxes
    id: checks
    attributes:
      label: First Check
      description: Please confirm and check all the following options.
      options:
        - label: I added a very descriptive title here.
          required: true
        - label: I used the GitHub search to find a similar question and didn't find it.
          required: true
        - label: I searched the SQLModel documentation, with the integrated search.
          required: true
        - label: I already searched in Google "How to X in SQLModel" and didn't find any information.
          required: true
        - label: I already read and followed all the tutorial in the docs and didn't find an answer.
          required: true
        - label: I already checked if it is not related to SQLModel but to [Pydantic](https://github.com/samuelcolvin/pydantic).
          required: true
        - label: I already checked if it is not related to SQLModel but to [SQLAlchemy](https://github.com/sqlalchemy/sqlalchemy).
          required: true
  - type: checkboxes
    id: help
    attributes:
      label: Commit to Help
      description: |
        After submitting this, I commit to one of:

          * Read open issues with questions until I find 2 issues where I can help someone and add a comment to help there.
          * I already hit the "watch" button in this repository to receive notifications and I commit to help at least 2 people that ask questions in the future.
          * Review one Pull Request by downloading the code and following all the review process](https://sqlmodel.tiangolo.com/help/#review-pull-requests).

      options:
        - label: I commit to help with one of those options 👆
          required: true
  - type: textarea
    id: example
    attributes:
      label: Example Code
      description: |
        Please add a self-contained, [minimal, reproducible, example](https://stackoverflow.com/help/minimal-reproducible-example) with your use case.

        If I (or someone) can copy it, run it, and see it right away, there's a much higher chance I (or someone) will be able to help you.

      placeholder: |
        from sqlmodel import Field, Session, SQLModel, create_engine


        class Hero(SQLModel, table=True):
            id: int | None = Field(default=None, primary_key=True)
            name: str
            secret_name: str
            age: int | None = None


        hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson")

        engine = create_engine("sqlite:///database.db")


        SQLModel.metadata.create_all(engine)

        with Session(engine) as session:
            session.add(hero_1)
            session.commit()
            session.refresh(hero_1)
            print(hero_1)
      render: python
    validations:
      required: true
  - type: textarea
    id: description
    attributes:
      label: Description
      description: |
        What is the problem, question, or error?

        Write a short description telling me what you are doing, what you expect to happen, and what is currently happening.
      placeholder: |
        * Create a Hero model.
        * Create a Hero instance.
        * Save it to a SQLite database.
        * Check the data with DB Browser for SQLite.
        * There's only one hero there, but I expected it to include many others recruited by the first one.
    validations:
      required: true
  - type: dropdown
    id: os
    attributes:
      label: Operating System
      description: What operating system are you on?
      multiple: true
      options:
        - Linux
        - Windows
        - macOS
        - Other
    validations:
      required: true
  - type: textarea
    id: os-details
    attributes:
      label: Operating System Details
      description: You can add more details about your operating system here, in particular if you chose "Other".
  - type: input
    id: sqlmodel-version
    attributes:
      label: SQLModel Version
      description: |
        What SQLModel version are you using?

        You can find the SQLModel version with:

        ```bash
        python -c "import sqlmodel; print(sqlmodel.__version__)"
        ```
    validations:
      required: true
  - type: input
    id: python-version
    attributes:
      label: Python Version
      description: |
        What Python version are you using?

        You can find the Python version with:

        ```bash
        python --version
        ```
    validations:
      required: true
  - type: textarea
    id: context
    attributes:
      label: Additional Context
      description: Add any additional context information or screenshots you think are useful.


================================================
FILE: .github/FUNDING.yml
================================================
github: [tiangolo]


================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
  - name: Security Contact
    about: Please report security vulnerabilities to security@tiangolo.com
  - name: Question or Problem
    about: Ask a question or ask about a problem in GitHub Discussions.
    url: https://github.com/fastapi/sqlmodel/discussions/categories/questions
  - name: Feature Request
    about: To suggest an idea or ask about a feature, please start with a question saying what you would like to achieve. There might be a way to do it already.
    url: https://github.com/fastapi/sqlmodel/discussions/categories/questions
  - name: Show and tell
    about: Show what you built with SQLModel or to be used with SQLModel.
    url: https://github.com/fastapi/sqlmodel/discussions/categories/show-and-tell


================================================
FILE: .github/ISSUE_TEMPLATE/privileged.yml
================================================
name: Privileged
description: You are @tiangolo or he asked you directly to create an issue here. If not, check the other options. 👇
body:
  - type: markdown
    attributes:
      value: |
        Thanks for your interest in SQLModel! 🚀

        If you are not @tiangolo or he didn't ask you directly to create an issue here, please start the conversation in a [Question in GitHub Discussions](https://github.com/fastapi/sqlmodel/discussions/categories/questions) instead.
  - type: checkboxes
    id: privileged
    attributes:
      label: Privileged issue
      description: Confirm that you are allowed to create an issue here.
      options:
        - label: I'm @tiangolo or he asked me directly to create an issue here.
          required: true
  - type: textarea
    id: content
    attributes:
      label: Issue Content
      description: Add the content of the issue here.


================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
  # GitHub Actions
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "daily"
    commit-message:
      prefix: ⬆
  # Python
  - package-ecosystem: "uv"
    directory: "/"
    schedule:
      interval: "daily"
    commit-message:
      prefix: ⬆


================================================
FILE: .github/labeler.yml
================================================
docs:
  - all:
    - changed-files:
      - any-glob-to-any-file:
        - docs/**
        - docs_src/**
      - all-globs-to-all-files:
        - '!sqlmodel/**'
        - '!pyproject.toml'

internal:
  - all:
    - changed-files:
      - any-glob-to-any-file:
        - .github/**
        - scripts/**
        - .gitignore
        - .pre-commit-config.yaml
        - requirements*.txt
        - uv.lock
      - all-globs-to-all-files:
        - '!docs/**'
        - '!sqlmodel/**'
        - '!pyproject.toml'


================================================
FILE: .github/workflows/add-to-project.yml
================================================
name: Add to Project

on:
  pull_request_target:
  issues:
    types:
      - opened
      - reopened

jobs:
  add-to-project:
    name: Add to project
    runs-on: ubuntu-latest
    steps:
      - uses: actions/add-to-project@v1.0.2
        with:
          project-url: https://github.com/orgs/fastapi/projects/2
          github-token: ${{ secrets.PROJECTS_TOKEN }}


================================================
FILE: .github/workflows/build-docs.yml
================================================
name: Build Docs
on:
  push:
    branches:
      - main
  pull_request:
    types:
      - opened
      - synchronize

jobs:
  changes:
    runs-on: ubuntu-latest
    # Required permissions
    permissions:
      pull-requests: read
    # Set job outputs to values from filter step
    outputs:
      docs: ${{ steps.filter.outputs.docs }}
    steps:
    - uses: actions/checkout@v6
    # For pull requests it's not necessary to checkout the code but for the main branch it is
    - uses: dorny/paths-filter@v4
      id: filter
      with:
        filters: |
          docs:
            - README.md
            - docs/**
            - docs_src/**
            - pyproject.toml
            - uv.lock
            - mkdocs.yml
            - mkdocs.env.yml
            - .github/workflows/build-docs.yml
            - .github/workflows/deploy-docs.yml
            - data/**

  build-docs:
    needs:
      - changes
    if: ${{ needs.changes.outputs.docs == 'true' }}
    runs-on: ubuntu-latest
    steps:
      - name: Dump GitHub context
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: echo "$GITHUB_CONTEXT"
      - uses: actions/checkout@v6
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version-file: ".python-version"
      - name: Setup uv
        uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true
          cache-dependency-glob: |
            pyproject.toml
            uv.lock
      - name: Install docs extras
        run: uv sync --locked --no-dev --group docs
      - uses: actions/cache@v5
        with:
          key: mkdocs-cards-${{ github.ref }}
          path: .cache
      - name: Build Docs
        run: uv run ./scripts/docs.py build
      - uses: actions/upload-artifact@v7
        with:
          name: docs-site
          path: ./site/**
          include-hidden-files: true

  # https://github.com/marketplace/actions/alls-green#why
  docs-all-green:  # This job does nothing and is only used for the branch protection
    if: always()
    needs:
      - build-docs
    runs-on: ubuntu-latest
    steps:
      - name: Decide whether the needed jobs succeeded or failed
        uses: re-actors/alls-green@release/v1
        with:
          jobs: ${{ toJSON(needs) }}
          allowed-skips: build-docs


================================================
FILE: .github/workflows/deploy-docs.yml
================================================
name: Deploy Docs
on:
  workflow_run:
    workflows:
      - Build Docs
    types:
      - completed

permissions:
  deployments: write
  issues: write
  pull-requests: write
  statuses: write

jobs:
  deploy-docs:
    runs-on: ubuntu-latest
    steps:
      - name: Dump GitHub context
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: echo "$GITHUB_CONTEXT"
      - uses: actions/checkout@v6
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version-file: ".python-version"
      - name: Setup uv
        uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true
          cache-dependency-glob: |
            pyproject.toml
            uv.lock
      - name: Install GitHub Actions dependencies
        run: uv sync --locked --no-dev --group github-actions
      - name: Deploy Docs Status Pending
        run: uv run ./scripts/deploy_docs_status.py
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
          RUN_ID: ${{ github.run_id }}
          STATE: "pending"
      - name: Clean site
        run: |
          rm -rf ./site
          mkdir ./site
      - uses: actions/download-artifact@v8
        with:
          path: ./site/
          pattern: docs-site
          merge-multiple: true
          github-token: ${{ secrets.GITHUB_TOKEN }}
          run-id: ${{ github.event.workflow_run.id }}
      - name: Deploy to Cloudflare Pages
        # hashFiles returns an empty string if there are no files
        if: hashFiles('./site/*')
        id: deploy
        env:
          PROJECT_NAME: sqlmodel
          BRANCH: ${{ ( github.event.workflow_run.head_repository.full_name == github.repository && github.event.workflow_run.head_branch == 'main' && 'main' ) || ( github.event.workflow_run.head_sha ) }}
        uses: cloudflare/wrangler-action@v3
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          command: pages deploy ./site --project-name=${{ env.PROJECT_NAME }} --branch=${{ env.BRANCH }}
      - name: Deploy Docs Status Error
        if: failure()
        run: uv run ./scripts/deploy_docs_status.py
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
          RUN_ID: ${{ github.run_id }}
          STATE: "error"
      - name: Comment Deploy
        run: uv run ./scripts/deploy_docs_status.py
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          DEPLOY_URL: ${{ steps.deploy.outputs.deployment-url }}
          COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
          RUN_ID: ${{ github.run_id }}
          STATE: "success"


================================================
FILE: .github/workflows/detect-conflicts.yml
================================================
name: "Conflict detector"
on:
  push:
  pull_request_target:
    types: [synchronize]

jobs:
  main:
    permissions:
      contents: read
      pull-requests: write
    runs-on: ubuntu-latest
    steps:
      - name: Check if PRs have merge conflicts
        uses: eps1lon/actions-label-merge-conflict@v3
        with:
          dirtyLabel: "conflicts"
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          commentOnDirty: "This pull request has a merge conflict that needs to be resolved."


================================================
FILE: .github/workflows/issue-manager.yml
================================================
name: Issue Manager

on:
  schedule:
    - cron: "13 18 * * *"
  issue_comment:
    types:
      - created
  issues:
    types:
      - labeled
  pull_request_target:
    types:
      - labeled
  workflow_dispatch:

permissions:
  issues: write
  pull-requests: write

jobs:
  issue-manager:
    if: github.repository_owner == 'fastapi'
    runs-on: ubuntu-latest
    steps:
      - name: Dump GitHub context
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: echo "$GITHUB_CONTEXT"
      - uses: tiangolo/issue-manager@0.6.0
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          config: >
            {
              "answered": {
                "delay": 864000,
                "message": "Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs."
              },
              "waiting": {
                "delay": 2628000,
                "message": "As this PR has been waiting for the original user for a while but seems to be inactive, it's now going to be closed. But if there's anyone interested, feel free to create a new PR.",
                "reminder": {
                    "before": "P3D",
                    "message": "Heads-up: this will be closed in 3 days unless there's new activity."
                }
              },
              "invalid": {
                "delay": 0,
                "message": "This was marked as invalid and will be closed now. If this is an error, please provide additional details."
              },
              "maybe-ai": {
                "delay": 0,
                "message": "This was marked as potentially AI generated and will be closed now. If this is an error, please provide additional details, make sure to read the docs about contributing and AI."
              }
            }


================================================
FILE: .github/workflows/labeler.yml
================================================
name: Labels
on:
  pull_request_target:
    types:
      - opened
      - synchronize
      - reopened
      # For label-checker
      - labeled
      - unlabeled

jobs:
  labeler:
    permissions:
      contents: read
      pull-requests: write
    runs-on: ubuntu-latest
    steps:
    - uses: actions/labeler@v6
      if: ${{ github.event.action != 'labeled' && github.event.action != 'unlabeled' }}
    - run: echo "Done adding labels"
  # Run this after labeler applied labels
  check-labels:
    needs:
      - labeler
    permissions:
      pull-requests: read
    runs-on: ubuntu-latest
    steps:
      - uses: docker://agilepathway/pull-request-label-checker:latest
        with:
          one_of: breaking,security,feature,bug,refactor,upgrade,docs,lang-all,internal
          repo_token: ${{ secrets.GITHUB_TOKEN }}


================================================
FILE: .github/workflows/latest-changes.yml
================================================
name: Latest Changes

on:
  pull_request_target:
    branches:
      - main
    types:
      - closed
  workflow_dispatch:
    inputs:
      number:
        description: PR number
        required: true
      debug_enabled:
        description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
        required: false
        default: 'false'

jobs:
  latest-changes:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          # To allow latest-changes to commit to the main branch
          token: ${{ secrets.SQLMODEL_LATEST_CHANGES }}
      # Allow debugging with tmate
      - name: Setup tmate session
        uses: mxschmitt/action-tmate@v3
        if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
        with:
          limit-access-to-actor: true
      - uses: tiangolo/latest-changes@0.4.1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          latest_changes_file: docs/release-notes.md
          latest_changes_header: '## Latest Changes'
          end_regex: '^## '
          debug_logs: true
          label_header_prefix: '### '


================================================
FILE: .github/workflows/pre-commit.yml
================================================
name: pre-commit

on:
  pull_request:
    types:
      - opened
      - synchronize

env:
  # Forks and Dependabot don't have access to secrets
  HAS_SECRETS: ${{ secrets.PRE_COMMIT != '' }}

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
      - name: Dump GitHub context
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: echo "$GITHUB_CONTEXT"
      - uses: actions/checkout@v6
        name: Checkout PR for own repo
        if: env.HAS_SECRETS == 'true'
        with:
          # To be able to commit it needs to fetch the head of the branch, not the
          # merge commit
          ref: ${{ github.head_ref }}
          # And it needs the full history to be able to compute diffs
          fetch-depth: 0
          # A token other than the default GITHUB_TOKEN is needed to be able to trigger CI
          token: ${{ secrets.PRE_COMMIT }}
      # pre-commit lite ci needs the default checkout configs to work
      - uses: actions/checkout@v6
        name: Checkout PR for fork
        if: env.HAS_SECRETS == 'false'
        with:
        # To be able to commit it needs the head branch of the PR, the remote one
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 0
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version-file: ".python-version"
      - name: Setup uv
        uses: astral-sh/setup-uv@v7
        with:
          cache-dependency-glob: |
            pyproject.toml
            uv.lock
      - name: Install Dependencies
        run: uv sync --locked
      - name: Run prek - pre-commit
        id: precommit
        run: uvx prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure
        continue-on-error: true
      - name: Commit and push changes
        if: env.HAS_SECRETS == 'true'
        run: |
          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"
          git add -A
          if git diff --staged --quiet; then
            echo "No changes to commit"
          else
            git commit -m "🎨 Auto format"
            git push
          fi
      - uses: pre-commit-ci/lite-action@v1.1.0
        if: env.HAS_SECRETS == 'false'
        with:
          msg: 🎨 Auto format
      - name: Error out on pre-commit errors
        if: steps.precommit.outcome == 'failure'
        run: exit 1

  # https://github.com/marketplace/actions/alls-green#why
  pre-commit-alls-green:  # This job does nothing and is only used for the branch protection
    if: always()
    needs:
      - pre-commit
    runs-on: ubuntu-latest
    steps:
      - name: Dump GitHub context
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: echo "$GITHUB_CONTEXT"
      - name: Decide whether the needed jobs succeeded or failed
        uses: re-actors/alls-green@release/v1
        with:
          jobs: ${{ toJSON(needs) }}


================================================
FILE: .github/workflows/publish.yml
================================================
name: Publish

on:
  release:
    types:
      - created
  workflow_dispatch:
    inputs:
      debug_enabled:
        description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
        required: false
        default: 'false'

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      id-token: write
      contents: read
    steps:
      - name: Dump GitHub context
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: echo "$GITHUB_CONTEXT"
      - uses: actions/checkout@v6
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version-file: ".python-version"
      - name: Install uv
        uses: astral-sh/setup-uv@v7
      - name: Build distribution
        run: uv build
      - name: Publish
        run: uv publish


================================================
FILE: .github/workflows/smokeshow.yml
================================================
name: Smokeshow

on:
  workflow_run:
    workflows: [Test]
    types: [completed]

permissions:
  statuses: write

jobs:
  smokeshow:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-python@v6
        with:
          python-version-file: ".python-version"
      - name: Setup uv
        uses: astral-sh/setup-uv@v7
        with:
          cache-dependency-glob: |
            pyproject.toml
            uv.lock
      - run: uv sync --locked --no-dev --group github-actions
      - uses: actions/download-artifact@v8
        with:
          name: coverage-html
          path: htmlcov
          github-token: ${{ secrets.GITHUB_TOKEN }}
          run-id: ${{ github.event.workflow_run.id }}
      # Try 5 times to upload coverage to smokeshow
      - name: Upload coverage to Smokeshow
        run: |
          for i in 1 2 3 4 5; do
            if uv run smokeshow upload htmlcov; then
                echo "Smokeshow upload success!"
                break
            fi
            echo "Smokeshow upload error, sleep 1 sec and try again."
            sleep 1
          done
        env:
          SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
          SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 99
          SMOKESHOW_GITHUB_CONTEXT: coverage
          SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
          SMOKESHOW_AUTH_KEY: ${{ secrets.SMOKESHOW_AUTH_KEY }}


================================================
FILE: .github/workflows/test-redistribute.yml
================================================
name: Test Redistribute

on:
  push:
    branches:
      - main
  pull_request:
    types:
      - opened
      - synchronize

jobs:
  test-redistribute:
    runs-on: ubuntu-latest
    steps:
      - name: Dump GitHub context
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: echo "$GITHUB_CONTEXT"
      - uses: actions/checkout@v6
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version-file: ".python-version"
      - name: Install build dependencies
        run: pip install build
      - name: Build source distribution
        run: python -m build --sdist
      - name: Decompress source distribution
        run: |
          cd dist
          tar xvf sqlmodel*.tar.gz
      - name: Install test dependencies
        run: |
          cd dist/sqlmodel*/
          pip install --group tests --editable .
      - name: Run source distribution tests
        run: |
          cd dist/sqlmodel*/
          bash scripts/test.sh
      - name: Build wheel distribution
        run: |
          cd dist
          pip wheel --no-deps sqlmodel*.tar.gz

  # https://github.com/marketplace/actions/alls-green#why
  test-redistribute-alls-green:  # This job does nothing and is only used for the branch protection
    if: always()
    needs:
      - test-redistribute
    runs-on: ubuntu-latest
    steps:
      - name: Decide whether the needed jobs succeeded or failed
        uses: re-actors/alls-green@release/v1
        with:
          jobs: ${{ toJSON(needs) }}


================================================
FILE: .github/workflows/test.yml
================================================
name: Test

on:
  push:
    branches:
      - main
  pull_request:
    types:
      - opened
      - synchronize
  workflow_dispatch:
    inputs:
      debug_enabled:
        description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
        required: false
        default: 'false'
  schedule:
    # cron every week on monday
    - cron: "0 0 * * 1"

env:
  UV_NO_SYNC: true

jobs:
  test:
    strategy:
      matrix:
        os: [ ubuntu-latest, windows-latest, macos-latest ]
        python-version: [ "3.14" ]
        uv-resolution:
          - highest
        include:
          - os: ubuntu-latest
            python-version: "3.10"
            uv-resolution: lowest-direct
          - os: macos-latest
            python-version: "3.11"
            uv-resolution: highest
          - os: windows-latest
            python-version: "3.12"
            uv-resolution: lowest-direct
          - os: ubuntu-latest
            python-version: "3.13"
            uv-resolution: highest
          - os: macos-latest
            python-version: "3.13"
            uv-resolution: highest
      fail-fast: false
    runs-on: ${{ matrix.os }}
    env:
      UV_PYTHON: ${{ matrix.python-version }}
      UV_RESOLUTION: ${{ matrix.uv-resolution }}
    steps:
      - uses: actions/checkout@v6
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version: ${{ matrix.python-version }}
      - name: Setup uv
        uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true
          cache-dependency-glob: |
            pyproject.toml
            uv.lock
      # Allow debugging with tmate
      - name: Setup tmate session
        uses: mxschmitt/action-tmate@v3
        if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
        with:
          limit-access-to-actor: true
      - name: Install Dependencies
        run: uv sync --no-dev --group tests
      - run: mkdir coverage
      - name: Test
        run: uv run bash scripts/test.sh
        env:
          COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.pydantic-version }}
          CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
      - name: Store coverage files
        uses: actions/upload-artifact@v7
        with:
          name: coverage-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.pydantic-version }}
          path: coverage
          include-hidden-files: true

  coverage-combine:
    needs:
      - test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-python@v6
        with:
          python-version-file: ".python-version"
      - name: Setup uv
        uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true
          cache-dependency-glob: |
            pyproject.toml
            uv.lock
      - name: Get coverage files
        uses: actions/download-artifact@v8
        with:
          pattern: coverage-*
          path: coverage
          merge-multiple: true
      - name: Install Dependencies
        run: uv sync --locked --no-dev --group tests
      - run: ls -la coverage
      - run: uv run coverage combine coverage
      - run: uv run coverage html --title "Coverage for ${{ github.sha }}"
      - name: Store coverage HTML
        uses: actions/upload-artifact@v7
        with:
          name: coverage-html
          path: htmlcov
          include-hidden-files: true
      - run: uv run coverage report --fail-under=99

  # https://github.com/marketplace/actions/alls-green#why
  alls-green:  # This job does nothing and is only used for the branch protection
    if: always()
    needs:
      - coverage-combine
    runs-on: ubuntu-latest
    steps:
      - name: Decide whether the needed jobs succeeded or failed
        uses: re-actors/alls-green@release/v1
        with:
          jobs: ${{ toJSON(needs) }}


================================================
FILE: .gitignore
================================================
*.pyc
.mypy_cache
.vscode
.idea
poetry.lock
dist
htmlcov
*.egg-info
.coverage*
coverage.xml
site
*.db
.cache
.venv*


================================================
FILE: .pre-commit-config.yaml
================================================
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: check-added-large-files
      - id: check-toml
      - id: check-yaml
        args:
          - --unsafe
      - id: end-of-file-fixer
      - id: trailing-whitespace

  - repo: local
    hooks:
      - id: local-ruff-check
        name: ruff check
        entry: uv run ruff check --force-exclude --fix --exit-non-zero-on-fix
        require_serial: true
        language: unsupported
        types: [python]

      - id: local-ruff-format
        name: ruff format
        entry: uv run ruff format --force-exclude --exit-non-zero-on-format
        require_serial: true
        language: unsupported
        types: [python]

      - id: local-mypy
        name: mypy check
        entry: uv run mypy sqlmodel tests/test_select_typing.py
        require_serial: true
        language: unsupported
        pass_filenames: false

      - id: generate-select
        language: unsupported
        name: generate-select
        entry: uv run ./scripts/generate_select.py
        files: ^scripts/generate_select\.py|sqlmodel/sql/_expression_select_gen\.py\.jinja2$

      - id: generate-readme
        language: unsupported
        name: generate README.md from index.md
        entry: uv run ./scripts/docs.py generate-readme
        files: ^docs/index\.md|scripts/docs\.py$
        pass_filenames: false


================================================
FILE: .python-version
================================================
3.10


================================================
FILE: CITATION.cff
================================================
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: SQLModel
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Sebastián
    family-names: Ramírez
    email: tiangolo@gmail.com
identifiers:
repository-code: 'https://github.com/fastapi/sqlmodel'
url: 'https://sqlmodel.tiangolo.com'
abstract: >-
  SQLModel, SQL databases in Python, designed for
  simplicity, compatibility, and robustness.
keywords:
  - fastapi
  - pydantic
  - sqlalchemy
license: MIT


================================================
FILE: CONTRIBUTING.md
================================================
Please read the [Development - Contributing](https://sqlmodel.tiangolo.com/contributing/) guidelines in the documentation site.


================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) 2021 Sebastián Ramírez

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


================================================
FILE: README.md
================================================
<p align="center">
  <a href="https://sqlmodel.tiangolo.com"><img src="https://sqlmodel.tiangolo.com/img/logo-margin/logo-margin-vector.svg#only-light" alt="SQLModel"></a>

</p>
<p align="center">
    <em>SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.</em>
</p>
<p align="center">
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3ATest+event%3Apush+branch%3Amain" target="_blank">
    <img src="https://github.com/fastapi/sqlmodel/actions/workflows/test.yml/badge.svg?event=push&branch=main" alt="Test">
</a>
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3APublish" target="_blank">
    <img src="https://github.com/fastapi/sqlmodel/actions/workflows/publish.yml/badge.svg" alt="Publish">
</a>
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/sqlmodel" target="_blank">
    <img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/sqlmodel.svg" alt="Coverage">
<a href="https://pypi.org/project/sqlmodel" target="_blank">
    <img src="https://img.shields.io/pypi/v/sqlmodel?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
</p>

---

**Documentation**: <a href="https://sqlmodel.tiangolo.com" target="_blank">https://sqlmodel.tiangolo.com</a>

**Source Code**: <a href="https://github.com/fastapi/sqlmodel" target="_blank">https://github.com/fastapi/sqlmodel</a>

---

SQLModel is a library for interacting with <abbr title='Also called "Relational databases"'>SQL databases</abbr> from Python code, with Python objects. It is designed to be intuitive, easy to use, highly compatible, and robust.

**SQLModel** is based on Python type annotations, and powered by <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a> and <a href="https://sqlalchemy.org/" class="external-link" target="_blank">SQLAlchemy</a>.

The key features are:

* **Intuitive to write**: Great editor support. <abbr title="also known as auto-complete, autocompletion, IntelliSense">Completion</abbr> everywhere. Less time debugging. Designed to be easy to use and learn. Less time reading docs.
* **Easy to use**: It has sensible defaults and does a lot of work underneath to simplify the code you write.
* **Compatible**: It is designed to be compatible with **FastAPI**, Pydantic, and SQLAlchemy.
* **Extensible**: You have all the power of SQLAlchemy and Pydantic underneath.
* **Short**: Minimize code duplication. A single type annotation does a lot of work. No need to duplicate models in SQLAlchemy and Pydantic.

## Sponsors

<!-- sponsors -->

<a href="https://www.govcert.lu" target="_blank" title="This project is being supported by GOVCERT.LU"><img src="https://sqlmodel.tiangolo.com/img/sponsors/govcert.png"></a>

<!-- /sponsors -->

## SQL Databases in FastAPI

<a href="https://fastapi.tiangolo.com" target="_blank"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" style="width: 20%;"></a>

**SQLModel** is designed to simplify interacting with SQL databases in <a href="https://fastapi.tiangolo.com" class="external-link" target="_blank">FastAPI</a> applications, it was created by the same <a href="https://tiangolo.com/" class="external-link" target="_blank">author</a>. 😁

It 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.

**SQLModel** is, in fact, a thin layer on top of **Pydantic** and **SQLAlchemy**, carefully designed to be compatible with both.

## Requirements

A recent and currently supported <a href="https://www.python.org/downloads/" class="external-link" target="_blank">version of Python</a>.

As **SQLModel** is based on **Pydantic** and **SQLAlchemy**, it requires them. They will be automatically installed when you install SQLModel.

## Installation

Make sure you create a <a href="https://sqlmodel.tiangolo.com/virtual-environments/" class="external-link" target="_blank">virtual environment</a>, activate it, and then install SQLModel, for example with:

<div class="termy">

```console
$ pip install sqlmodel
---> 100%
Successfully installed sqlmodel
```

</div>

## Example

For an introduction to databases, SQL, and everything else, see the <a href="https://sqlmodel.tiangolo.com/databases/" target="_blank">SQLModel documentation</a>.

Here's a quick example. ✨

### A SQL Table

Imagine you have a SQL table called `hero` with:

* `id`
* `name`
* `secret_name`
* `age`

And you want it to have this data:

| id | name | secret_name | age |
-----|------|-------------|------|
| 1  | Deadpond | Dive Wilson | null |
| 2  | Spider-Boy | Pedro Parqueador | null |
| 3  | Rusty-Man | Tommy Sharp | 48 |

### Create a SQLModel Model

Then you could create a **SQLModel** model like this:

```Python
from sqlmodel import Field, SQLModel


class Hero(SQLModel, table=True):
    id: int | None = Field(default=None, primary_key=True)
    name: str
    secret_name: str
    age: int | None = None
```

That class `Hero` is a **SQLModel** model, the equivalent of a SQL table in Python code.

And each of those class attributes is equivalent to each **table column**.

### Create Rows

Then you could **create each row** of the table as an **instance** of the model:

```Python
hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson")
hero_2 = Hero(name="Spider-Boy", secret_name="Pedro Parqueador")
hero_3 = Hero(name="Rusty-Man", secret_name="Tommy Sharp", age=48)
```

This way, you can use conventional Python code with **classes** and **instances** that represent **tables** and **rows**, and that way communicate with the **SQL database**.

### Editor Support

Everything is designed for you to get the best developer experience possible, with the best editor support.

Including **autocompletion**:

<img class="shadow" src="https://sqlmodel.tiangolo.com/img/index/autocompletion01.png">

And **inline errors**:

<img class="shadow" src="https://sqlmodel.tiangolo.com/img/index/inline-errors01.png">

### Write to the Database

You 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:

```Python hl_lines="16  19  21-25"
from sqlmodel import Field, Session, SQLModel, create_engine


class Hero(SQLModel, table=True):
    id: int | None = Field(default=None, primary_key=True)
    name: str
    secret_name: str
    age: int | None = None


hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson")
hero_2 = Hero(name="Spider-Boy", secret_name="Pedro Parqueador")
hero_3 = Hero(name="Rusty-Man", secret_name="Tommy Sharp", age=48)


engine = create_engine("sqlite:///database.db")


SQLModel.metadata.create_all(engine)

with Session(engine) as session:
    session.add(hero_1)
    session.add(hero_2)
    session.add(hero_3)
    session.commit()
```

That will save a **SQLite** database with the 3 heroes.

### Select from the Database

Then you could write queries to select from that same database, for example with:

```Python hl_lines="13-17"
from sqlmodel import Field, Session, SQLModel, create_engine, select


class Hero(SQLModel, table=True):
    id: int | None = Field(default=None, primary_key=True)
    name: str
    secret_name: str
    age: int | None = None


engine = create_engine("sqlite:///database.db")

with Session(engine) as session:
    statement = select(Hero).where(Hero.name == "Spider-Boy")
    hero = session.exec(statement).first()
    print(hero)
```

### Editor Support Everywhere

**SQLModel** was carefully designed to give you the best developer experience and editor support, **even after selecting data** from the database:

<img class="shadow" src="https://sqlmodel.tiangolo.com/img/index/autocompletion02.png">

## SQLAlchemy and Pydantic

That class `Hero` is a **SQLModel** model.

But 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**.

And 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**.

## License

This project is licensed under the terms of the [MIT license](https://github.com/fastapi/sqlmodel/blob/main/LICENSE).


================================================
FILE: SECURITY.md
================================================
# Security Policy

Security is very important for SQLModel and its community. 🔒

Learn more about it below. 👇

## Versions

The latest versions of SQLModel are supported.

You are encouraged to [write tests](https://sqlmodel.tiangolo.com/tutorial/fastapi/tests/) for your application and update your SQLModel version frequently after ensuring that your tests are passing. This way you will benefit from the latest features, bug fixes, and **security fixes**.

## Reporting a Vulnerability

If you think you found a vulnerability, and even if you are not sure about it, please report it right away by sending an email to: security@tiangolo.com. Please try to be as explicit as possible, describing all the steps and example code to reproduce the security issue.

I (the author, [@tiangolo](https://twitter.com/tiangolo)) will review it thoroughly and get back to you.

## Public Discussions

Please restrain from publicly discussing a potential security vulnerability. 🙊

It's better to discuss privately and try to find a solution first, to limit the potential impact as much as possible.

---

Thanks for your help!

The SQLModel community and I thank you for that. 🙇


================================================
FILE: data/members.yml
================================================
members:
- login: tiangolo
- login: alejsdev


================================================
FILE: data/sponsors.yml
================================================
gold: []
silver:
  - url: https://www.govcert.lu
    title: This project is being supported by GOVCERT.LU
    img: https://sqlmodel.tiangolo.com/img/sponsors/govcert.png
bronze: []


================================================
FILE: docs/about/index.md
================================================
# About

About **SQLModel**, its design, inspiration, and more. 🤓


================================================
FILE: docs/advanced/decimal.md
================================================
# Decimal Numbers

In some cases you might need to be able to store decimal numbers with guarantees about the precision.

This is particularly important if you are storing things like **currencies**, **prices**, **accounts**, and others, as you would want to know that you wouldn't have rounding errors.

As an example, if you open Python and sum `1.1` + `2.2` you would expect to see `3.3`, but you will actually get `3.3000000000000003`:

```Python
>>> 1.1 + 2.2
3.3000000000000003
```

This is because of the way numbers are stored in "ones and zeros" (binary). But Python has a module and some types to have strict decimal values. You can read more about it in the official <a href="https://docs.python.org/3/library/decimal.html" class="external-link" target="_blank">Python docs for Decimal</a>.

Because databases store data in the same ways as computers (in binary), they would have the same types of issues. And because of that, they also have a special **decimal** type.

In most cases this would probably not be a problem, for example measuring views in a video, or the life bar in a videogame. But as you can imagine, this is particularly important when dealing with **money** and **finances**.

## Decimal Types

Pydantic has special support for <a href="https://docs.pydantic.dev/latest/api/standard_library_types/#decimaldecimal" class="external-link" target="_blank">`Decimal` types</a>.

When you use `Decimal` you can specify the number of digits and decimal places to support in the `Field()` function. They will be validated by Pydantic (for example when using FastAPI) and the same information will also be used for the database columns.

/// info

For the database, **SQLModel** will use <a href="https://docs.sqlalchemy.org/en/20/core/type_basics.html#sqlalchemy.types.DECIMAL" class="external-link" target="_blank">SQLAlchemy's `DECIMAL` type</a>.

///

## Decimals in SQLModel

Let's say that each hero in the database will have an amount of money. We could make that field a `Decimal` type using the `condecimal()` function:

{* ./docs_src/advanced/decimal/tutorial001_py310.py ln[1:11] hl[11] *}

Here we are saying that `money` can have at most `5` digits with `max_digits`, **this includes the integers** (to the left of the decimal dot) **and the decimals** (to the right of the decimal dot).

We are also saying that the number of decimal places (to the right of the decimal dot) is `3`, so we can have **3 decimal digits** for these numbers in the `money` field. This means that we will have **2 digits for the integer part** and **3 digits for the decimal part**.

✅ So, for example, these are all valid numbers for the `money` field:

* `12.345`
* `12.3`
* `12`
* `1.2`
* `0.123`
* `0`

🚫 But these are all invalid numbers for that `money` field:

* `1.2345`
  * This number has more than 3 decimal places.
* `123.234`
  * This number has more than 5 digits in total (integer and decimal part).
* `123`
  * Even though this number doesn't have any decimals, we still have 3 places saved for them, which means that we can **only use 2 places** for the **integer part**, and this number has 3 integer digits. So, the allowed number of integer digits is `max_digits` - `decimal_places` = 2.

/// tip

Make sure you adjust the number of digits and decimal places for your own needs, in your own application. 🤓

///

## Create models with Decimals

When creating new models you can actually pass normal (`float`) numbers, Pydantic will automatically convert them to `Decimal` types, and **SQLModel** will store them as `Decimal` types in the database (using SQLAlchemy).

{* ./docs_src/advanced/decimal/tutorial001_py310.py ln[24:34] hl[25:27] *}

## Select Decimal data

Then, when working with Decimal types, you can confirm that they indeed avoid those rounding errors from floats:

{* ./docs_src/advanced/decimal/tutorial001_py310.py ln[37:50] hl[49:50] *}

## Review the results

Now if you run this, instead of printing the unexpected number `3.3000000000000003`, it prints `3.300`:

<div class="termy">

```console
$ python app.py

// Some boilerplate and previous output omitted 😉

// The type of money is Decimal('1.100')
Hero 1: id=1 secret_name='Dive Wilson' age=None name='Deadpond' money=Decimal('1.100')

// More output omitted here 🤓

// The type of money is Decimal('1.100')
Hero 2: id=3 secret_name='Tommy Sharp' age=48 name='Rusty-Man' money=Decimal('2.200')

// No rounding errors, just 3.3! 🎉
Total money: 3.300
```

</div>

/// warning

Although Decimal types are supported and used in the Python side, not all databases support it. In particular, SQLite doesn't support decimals, so it will convert them to the same floating `NUMERIC` type it supports.

But decimals are supported by most of the other SQL databases. 🎉

///


================================================
FILE: docs/advanced/index.md
================================================
# Advanced User Guide

The **Advanced User Guide** is gradually growing, you can already read about some advanced topics.

At some point it will include:

* How to use `async` and `await` with the async session.
* How to run migrations.
* How to combine **SQLModel** models with SQLAlchemy.
* ...and more. 🤓


================================================
FILE: docs/advanced/uuid.md
================================================
# UUID (Universally Unique Identifiers)

We have discussed some data types like `str`, `int`, etc.

There's another data type called `UUID` (Universally Unique Identifier).

You might have seen **UUIDs**, for example in URLs. They look something like this:

```
4ff2dab7-bffe-414d-88a5-1826b9fea8df
```

UUIDs can be particularly useful as an alternative to auto-incrementing integers for **primary keys**.

/// info

Official support for UUIDs was added in SQLModel version `0.0.20`.

///

## About UUIDs

UUIDs are numbers with 128 bits, that is, 16 bytes.

They are normally seen as 32 <abbr title="numbers in base 16 (instead of base 10), using letters from A to F to represent the numbers from 10 to 15">hexadecimal</abbr> characters separated by dashes.

There are several versions of UUID, some versions include the current time in the bytes, but **UUIDs version 4** are mainly random, the way they are generated makes them virtually **unique**.

### Distributed UUIDs

You could generate one UUID in one computer, and someone else could generate another UUID in another computer, and it would be almost **impossible** for both UUIDs to be the **same**.

This means that you don't have to wait for the DB to generate the ID for you, you can **generate it in code before sending it to the database**, because you can be quite certain it will be unique.

/// note | Technical Details

Because the number of possible UUIDs is so large (2^128), the probability of generating the same UUID version 4 (the random ones) twice is very low.

If you had 103 trillion version 4 UUIDs stored in the database, the probability of generating a duplicated new one is one in a billion. 🤓

///

For the same reason, if you decided to migrate your database, combine it with another database and mix records, etc. you would most probably be able to **just use the same UUIDs** you had originally.

/// warning

There's still a chance you could have a collision, but it's very low. In most cases you could assume you wouldn't have it, but it would be good to be prepared for it.

///

### UUIDs Prevent Information Leakage

Because UUIDs version 4 are **random**, you could give these IDs to the application users or to other systems, **without exposing information** about your application.

When using **auto-incremented integers** for primary keys, you could implicitly expose information about your system. For example, someone could create a new hero, and by getting the hero ID `20` **they would know that you have 20 heroes** in your system (or even less, if some heroes were already deleted).

### UUID Storage

Because UUIDs are 16 bytes, they would **consume more space** in the database than a smaller auto-incremented integer (commonly 4 bytes).

Depending on the database you use, UUIDs could have **better or worse performance**. If you are concerned about that, you should check the documentation for the specific database.

SQLite doesn't have a specific UUID type, so it will store the UUID as a string. Other databases like Postgres have a specific UUID type which would result in better performance and space usage than strings.

## Models with UUIDs

To use UUIDs as primary keys we need to import `uuid`, which is part of the Python standard library (we don't have to install anything) and use `uuid.UUID` as the **type** for the ID field.

We also want the Python code to **generate a new UUID** when creating a new instance, so we use `default_factory`.

The parameter `default_factory` takes a function (or in general, a "<abbr title="Something that can be called as a function.">callable</abbr>"). This function will be **called when creating a new instance** of the model and the value returned by the function will be used as the default value for the field.

For the function in `default_factory` we pass `uuid.uuid4`, which is a function that generates a **new UUID version 4**.

/// tip

We don't call `uuid.uuid4()` ourselves in the code (we don't put the parenthesis). Instead, we pass the function itself, just `uuid.uuid4`, so that SQLModel can call it every time we create a new instance.

///

This means that the UUID will be generated in the Python code, **before sending the data to the database**.

{* ./docs_src/advanced/uuid/tutorial001_py310.py ln[1:10] hl[1,7] *}

Pydantic has support for <a href="https://docs.pydantic.dev/latest/api/standard_library_types/#uuid" class="external-link" target="_blank">`UUID` types</a>.

For the database, **SQLModel** internally uses <a href="https://docs.sqlalchemy.org/en/20/core/type_basics.html#sqlalchemy.types.Uuid" class="external-link" target="_blank">SQLAlchemy's `Uuid` type</a>.

### Create a Record with a UUID

When creating a `Hero` record, the `id` field will be **automatically populated** with a new UUID because we set `default_factory=uuid.uuid4`.

As `uuid.uuid4` will be called when creating the model instance, even before sending it to the database, we can **access and use the ID right away**.

And that **same ID (a UUID)** will be saved in the database.

{* ./docs_src/advanced/uuid/tutorial001_py310.py ln[23:34] hl[25,27,29,34] *}

### Select a Hero

We can do the same operations we could do with other fields.

For example we can **select a hero by ID**:

{* ./docs_src/advanced/uuid/tutorial001_py310.py ln[37:54] hl[49] *}

/// tip

Even if a database like SQLite stores the UUID as a string, we can select and run comparisons using a Python UUID object and it will work.

SQLModel (actually SQLAlchemy) will take care of making it work. ✨

///

#### Select with `session.get()`

We could also select by ID with `session.get()`:

{* ./docs_src/advanced/uuid/tutorial002_py310.py ln[37:53] hl[49] *}

The same way as with other fields, we could update, delete, etc. 🚀

### Run the program

If you run the program, you will see the **UUID** generated in the Python code, and then the record **saved in the database with the same UUID**.

<div class="termy">

```console
$ python app.py

// Some boilerplate and previous output omitted 😉

// In SQLite, the UUID will be stored as a string
// other DBs like Postgres have a specific UUID type
CREATE TABLE hero (
        id CHAR(32) NOT NULL,
        name VARCHAR NOT NULL,
        secret_name VARCHAR NOT NULL,
        age INTEGER,
        PRIMARY KEY (id)
)

// Before saving in the DB we already have the UUID
The hero before saving in the DB
name='Deadpond' secret_name='Dive Wilson' id=UUID('0e44c1a6-88d3-4a35-8b8a-307faa2def28') age=None
The hero ID was already set
0e44c1a6-88d3-4a35-8b8a-307faa2def28

// The SQL statement to insert the record uses our UUID
INSERT INTO hero (id, name, secret_name, age) VALUES (?, ?, ?, ?)
('0e44c1a688d34a358b8a307faa2def28', 'Deadpond', 'Dive Wilson', None)

// And indeed, the record was saved with the UUID we created 😎
After saving in the DB
age=None id=UUID('0e44c1a6-88d3-4a35-8b8a-307faa2def28') name='Deadpond' secret_name='Dive Wilson'

// Now we create a new hero (to select it in a bit)
Created hero:
age=None id=UUID('9d90d186-85db-4eaa-891a-def7b4ae2dab') name='Spider-Boy' secret_name='Pedro Parqueador'
Created hero ID:
9d90d186-85db-4eaa-891a-def7b4ae2dab

// And now we select it
Selected hero:
age=None id=UUID('9d90d186-85db-4eaa-891a-def7b4ae2dab') name='Spider-Boy' secret_name='Pedro Parqueador'
Selected hero ID:
9d90d186-85db-4eaa-891a-def7b4ae2dab
```

</div>

## Learn More

You can learn more about **UUIDs** in:

* The official <a href="https://docs.python.org/3/library/uuid.html" class="external-link" target="_blank">Python docs for UUID</a>.
* The <a href="https://en.wikipedia.org/wiki/Universally_unique_identifier" class="external-link" target="_blank">Wikipedia for UUID</a>.


================================================
FILE: docs/alternatives.md
================================================
# Alternatives, Inspiration and Comparisons

Coming soon...


================================================
FILE: docs/contributing.md
================================================
# Contributing

First, you might want to see the basic ways to [help SQLModel and get help](help.md){.internal-link target=_blank}.

## Developing

If you already cloned the <a href="https://github.com/fastapi/sqlmodel" class="external-link" target="_blank">sqlmodel repository</a> and you want to deep dive in the code, here are some guidelines to set up your environment.

### Install Requirements Using `uv`

Create a virtual environment and install the required packages in one command:

<div class="termy">

```console
$ uv sync

---> 100%
```

</div>

It will install all the dependencies and your local SQLModel in your local environment.

### Using your Local SQLModel

If you create a Python file that imports and uses SQLModel, and run it with the Python from your local environment, it will use your cloned local SQLModel source code.

And if you update that local SQLModel source code when you run that Python file again, it will use the fresh version of SQLModel you just edited.

That way, you don't have to "install" your local version to be able to test every change.

/// note | "Technical Details"

This only happens when you install using this included `requirements.txt` instead of running `pip install sqlmodel` directly.

That is because inside the `requirements.txt` file, the local version of SQLModel is marked to be installed in "editable" mode, with the `-e` option.

///

### Format

There is a script that you can run that will format and clean all your code:

<div class="termy">

```console
$ bash scripts/format.sh
```

</div>

It will also auto-sort all your imports.

## Tests

There is a script that you can run locally to test all the code and generate coverage reports in HTML:

<div class="termy">

```console
$ bash scripts/test.sh
```

</div>

This command generates a directory `./htmlcov/`, if you open the file `./htmlcov/index.html` in your browser, you can explore interactively the regions of code that are covered by the tests, and notice if there is any region missing.

## Docs

First, make sure you set up your environment as described above, that will install all the requirements.

### Docs Live

During local development, there is a script that builds the site and checks for any changes, live-reloading:

<div class="termy">

```console
$ python ./scripts/docs.py live

<span style="color: green;">[INFO]</span> Serving on http://127.0.0.1:8008
<span style="color: green;">[INFO]</span> Start watching changes
<span style="color: green;">[INFO]</span> Start detecting changes
```

</div>

It will serve the documentation on `http://127.0.0.1:8008`.

That way, you can edit the documentation/source files and see the changes live.

/// tip

Alternatively, you can perform the same steps that scripts does manually.

Go into the docs director at `docs/`:

```console
$ cd docs/
```

Then run `mkdocs` in that directory:

```console
$ mkdocs serve --dev-addr 8008
```

///

#### Typer CLI (Optional)

The instructions here show you how to use the script at `./scripts/docs.py` with the `python` program directly.

But you can also use <a href="https://typer.tiangolo.com/typer-cli/" class="external-link" target="_blank">Typer CLI</a>, and you will get autocompletion in your terminal for the commands after installing completion.

If you install Typer CLI, you can install completion with:

<div class="termy">

```console
$ typer --install-completion

zsh completion installed in /home/user/.bashrc.
Completion will take effect once you restart the terminal.
```

</div>

### Docs Structure

The documentation uses <a href="https://www.mkdocs.org/" class="external-link" target="_blank">MkDocs</a>.

And there are extra tools/scripts in place in `./scripts/docs.py`.

/// tip

You don't need to see the code in `./scripts/docs.py`, you just use it in the command line.

///

All the documentation is in Markdown format in the directory `./docs`.

Many of the tutorials have blocks of code.

In most of the cases, these blocks of code are actual complete applications that can be run as is.

In fact, those blocks of code are not written inside the Markdown, they are Python files in the `./docs_src/` directory.

And those Python files are included/injected in the documentation when generating the site.

### Docs for Tests

Most of the tests actually run against the example source files in the documentation.

This helps to make sure that:

* The documentation is up-to-date.
* The documentation examples can be run as is.
* Most of the features are covered by the documentation, ensured by test coverage.

## Automated Code and AI

You are encouraged to use all the tools you want to do your work and contribute as efficiently as possible, this includes AI (LLM) tools, etc. Nevertheless, contributions should have meaningful human intervention, judgement, context, etc.

If the **human effort** put in a PR, e.g. writing LLM prompts, is **less** than the **effort we would need to put** to **review it**, please **don't** submit the PR.

Think of it this way: we can already write LLM prompts or run automated tools ourselves, and that would be faster than reviewing external PRs.

### Closing Automated and AI PRs

If we see PRs that seem AI generated or automated in similar ways, we'll flag them and close them.

The same applies to comments and descriptions, please don't copy paste the content generated by an LLM.

### Human Effort Denial of Service

Using automated tools and AI to submit PRs or comments that we have to carefully review and handle would be the equivalent of a <a href="https://en.wikipedia.org/wiki/Denial-of-service_attack" class="external-link" target="_blank">Denial-of-service attack</a> on our human effort.

It would be very little effort from the person submitting the PR (an LLM prompt) that generates a large amount of effort on our side (carefully reviewing code).

Please don't do that.

We'll need to block accounts that spam us with repeated automated PRs or comments.

### Use Tools Wisely

As Uncle Ben said:

<blockquote>
With great <strike>power</strike> <strong>tools</strong> comes great responsibility.
</blockquote>

Avoid inadvertently doing harm.

You have amazing tools at hand, use them wisely to help effectively.


================================================
FILE: docs/css/custom.css
================================================
/* Fira Code, including characters used by Rich output, like the "heavy right-pointing angle bracket ornament", not included in Google Fonts */
@import url(https://cdn.jsdelivr.net/npm/firacode@6.2.0/distr/fira_code.css);
/* Noto Color Emoji for emoji support with the same font everywhere */
@import url(https://fonts.googleapis.com/css2?family=Noto+Color+Emoji&display=swap);

/* Override default code font in Material for MkDocs to Fira Code */
:root {
    --md-code-font: "Fira Code", monospace, "Noto Color Emoji";
}

/* Override default regular font in Material for MkDocs to include Noto Color Emoji */
:root {
    --md-text-font: "Roboto", "Noto Color Emoji";
}

.termynal-comment {
    color: #4a968f;
    font-style: italic;
    display: block;
}

.termy [data-termynal] {
    white-space: pre-wrap;
}

.termy .linenos {
    display: none;
}

/* External links: detected by JS comparing origin to site origin
   JS sets data-external-link on links pointing outside the site
   Skip image links, .no-link-icon, and .announce-link */
a[data-external-link]:not(:has(img)):not(.no-link-icon):not(.announce-link) {
  /* For right to left languages */
  direction: ltr;
  display: inline-block;
}

a[data-external-link]:not(:has(img)):not(.no-link-icon):not(.announce-link)::after {
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-left: 0.25em;
  vertical-align: middle;
  opacity: 0.55;
  background: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
}

a[data-external-link]:not(:has(img)):not(.no-link-icon):not(.announce-link):hover::after {
  opacity: 0.85;
}

/* Internal links opening in new tab: same-origin links with target=_blank
   JS sets data-internal-link on links pointing to the same site origin
   Skip image links, .no-link-icon, and .announce-link */
a[data-internal-link][target="_blank"]:not(:has(img)):not(.no-link-icon):not(.announce-link) {
  /* For right to left languages */
  direction: ltr;
  display: inline-block;
}

a[data-internal-link][target="_blank"]:not(:has(img)):not(.no-link-icon):not(.announce-link)::after {
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-left: 0.25em;
  vertical-align: middle;
  opacity: 0.55;
  background: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='7' width='14' height='14' rx='2'/%3E%3Cpath d='M7 3h14v14'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='7' width='14' height='14' rx='2'/%3E%3Cpath d='M7 3h14v14'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
}

a[data-internal-link][target="_blank"]:not(:has(img)):not(.no-link-icon):not(.announce-link):hover::after {
  opacity: 0.85;
}

/* Disable link icons in footer and header nav */
.md-footer a::after,
.md-header a::after {
  content: none !important;
}

.shadow {
    box-shadow: 5px 5px 10px #999;
}

.user-list {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.user-list-center {
    justify-content: space-evenly;
}

.user {
    margin: 1em;
    min-width: 7em;
}

.user .avatar-wrapper {
    width: 80px;
    height: 80px;
    margin: 10px auto;
    overflow: hidden;
    border-radius: 50%;
    position: relative;
}

.user .avatar-wrapper img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.user .title {
    text-align: center;
}

.user .count {
    font-size: 80%;
    text-align: center;
}


================================================
FILE: docs/css/termynal.css
================================================
/**
 * termynal.js
 *
 * @author Ines Montani <ines@ines.io>
 * @version 0.0.1
 * @license MIT
 */

:root {
    --color-bg: #252a33;
    --color-text: #eee;
    --color-text-subtle: #a2a2a2;
}

[data-termynal] {
    width: 750px;
    max-width: 100%;
    background: var(--color-bg);
    color: var(--color-text);
    /* font-size: 18px; */
    font-size: 15px;
    /* font-family: 'Fira Mono', Consolas, Menlo, Monaco, 'Courier New', Courier, monospace; */
    font-family: var(--md-code-font-family), 'Roboto Mono', 'Fira Mono', Consolas, Menlo, Monaco, 'Courier New', Courier, monospace;
    border-radius: 4px;
    padding: 75px 45px 35px;
    position: relative;
    -webkit-box-sizing: border-box;
            box-sizing: border-box;
    /* Custom line-height */
    line-height: 1.2;
}

[data-termynal]:before {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    display: inline-block;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    /* A little hack to display the window buttons in one pseudo element. */
    background: #d9515d;
    -webkit-box-shadow: 25px 0 0 #f4c025, 50px 0 0 #3ec930;
            box-shadow: 25px 0 0 #f4c025, 50px 0 0 #3ec930;
}

[data-termynal]:after {
    content: 'bash';
    position: absolute;
    color: var(--color-text-subtle);
    top: 5px;
    left: 0;
    width: 100%;
    text-align: center;
}

a[data-terminal-control] {
    text-align: right;
    display: block;
    color: #aebbff;
}

[data-ty] {
    display: block;
    line-height: 2;
}

[data-ty]:before {
    /* Set up defaults and ensure empty lines are displayed. */
    content: '';
    display: inline-block;
    vertical-align: middle;
}

[data-ty="input"]:before,
[data-ty-prompt]:before {
    margin-right: 0.75em;
    color: var(--color-text-subtle);
}

[data-ty="input"]:before {
    content: '$';
}

[data-ty][data-ty-prompt]:before {
    content: attr(data-ty-prompt);
}

[data-ty-cursor]:after {
    content: attr(data-ty-cursor);
    font-family: monospace;
    margin-left: 0.5em;
    -webkit-animation: blink 1s infinite;
            animation: blink 1s infinite;
}


/* Cursor animation */

@-webkit-keyframes blink {
    50% {
        opacity: 0;
    }
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}


================================================
FILE: docs/databases.md
================================================
# Intro to Databases

/// info

Are you a seasoned developer and already know everything about databases? 🤓

Then you can skip to the next sections right away.

///

If you don't know everything about databases, here's a quick overview.

You can always study much more on your own later.

But this should help you start using databases and being productive with **SQLModel**. 🚀

## What is a Database

So, what is a database?

A **database** is a system to store and manage data in a structured and very efficient way.

/// tip

It's very common to abbreviate the word "database" as **"DB"**.

///

As there's a lot of information about databases, and it can get very technical and academic, I'll give you a quick overview about some of the main concepts here.

I'll even tell you a bit about different types of databases, including the ones not covered by SQLModel ("NoSQL" databases).

## Why Use a Database

When starting to program, it might **not be obvious** why having a database apart from the code for your program is a **good idea**. Let's start with that.

/// tip

If that's obvious to you, just continue in the next section below. 👇

///

In your code you already have **variables**, **dictionaries**, **lists**, etc. They all store **data** in some way already. Why would you need to have a separate database?

If you look closely, your code is **static**, it doesn't really change over time *once you run it*. Of course, you change the code frequently, adding features, etc, but once you start Python running your code, the program stays as it was when you started it. And if you change the code, the program will only change **once you run it again**.

And even if you change things in variables, once the program terminates, all that data that was in **memory** is **gone**. 🔥

In most of the cases, the objective of your program is to do something with data *outside* of the program.

* It could be just moving **files** from one place to the other.
* Or it could be taking data from the user in the **terminal** and showing it differently.
* Or a **web API** that takes some data and process it in some way, etc.

In most cases, the data *comes from outside* the program or *ends outside the program* (for example, shown on the screen, in a file, etc).

In many cases, you need your program to be able to **create** and store data, **read** it, **update** it, **delete** it, etc.

You could do all that by reading and writing to files from your code. And that works in simple cases. But for most complex systems with data that is a bit more **complex** that strategy is not very efficient. And you would have to deal with a lot of **caveats**, keeping the data in sync, making sure it is safely stored, etc.

Databases are designed to **solve these problems**, making the process of handling data much more efficient, and independent of your code. ✨

## How to Interact with a Database

There are many databases of many types.

### A single file database

A database could be a single file called `heroes.db`, managed with code in a very efficient way. An example would be SQLite, more about that in a bit.

![database as a single file](img/databases/single-file.drawio.svg)

### A server database

A database could also be a system running as an application on a server, handling multiple files internally in optimized formats.

Like a web server, but communicating in a custom and very efficient way. That is the most common type of database interaction.

In this case, your code would talk to this server application instead of reading or modifying files directly.

The database could be located in a different server/machine:

![database in an external server](img/databases/external-server.drawio.svg)

Or the database could be located in the same server/machine:

![database in the same server](img/databases/same-server.drawio.svg)

The most important aspect of these types of databases is that **your code doesn't read or modify** the files containing the data directly.

Instead, your code communicates with the database application and that database application is the one that actually reads and modifies its data files. This is because this database application is normally **much more efficient** than what your code could be.

Some examples of databases that work like this could be **PostgreSQL**, **MySQL**, or **MongoDB**.

### Distributed servers

In some cases, the database could even be a group of server applications running on different machines, working together and communicating between them to be more efficient and handle more data.

In this case, your code would talk to one or more of these server applications running on different machines.

![distributed database in multiple servers](img/databases/multiple-servers.drawio.svg)

Most of the databases that work as server applications also support multiple servers in one way or another.

Having distributed systems also creates additional challenges, so there's a high chance that you would first interact with a single server application or one based on a single file.

## SQL Databases

We already talked about the different ways to interact with a database and how they handle files, etc. That applies to most or all of the databases.

But there's another way to categorize databases that is very important. As you can imagine, there are many types of databases and many databases in each group. But in general, they can be separated in two big groups: "SQL Databases" and "NoSQL Databases".

We will get to why the name "SQL" in a bit, but first, let's see what is it all about.

### SQLModel for SQL Databases

**SQLModel** is a tool to help you with **SQL Databases**.

It cannot help you much with **NoSQL Databases**. Nevertheless, I'll explain a bit about them here.

## Invent SQL Databases

A long time ago, some smart people realized that a great way to store data was putting it in different tables.

And by "table" I mean just data in a grid, with different columns and rows, pretty much like a single spreadsheet.

Each row would represent a specific item or **record**. And each column would represent a specific attribute or field of that record.

### An example of a big table

Let's imagine that we need to store some data about heroes.

If we worked with a single table to store our heroes, it could be like this:

<table>
<tr>
<th>id</th><th>name</th><th>secret_name</th><th>age</th><th>team</th><th>headquarters</th>
</tr>
<tr>
<td>1</td><td>Deadpond</td><td>Dive Wilson</td><td>null</td><td>Z-Factor</td><td>Sister Margaret's Bar</td>
</tr>
<tr>
<td>2</td><td>Spider-Boy</td><td>Pedro Parqueador</td><td>null</td><td>Preventers</td><td>Sharp Tower</td>
</tr>
<tr>
<td>3</td><td>Rusty-Man</td><td>Tommy Sharp</td><td>48</td><td>Preventers</td><td>Sharp Tower</td>
</tr>
</table>

That's probably what we would have to do with a single table, for example, with a single spreadsheet.

But there are some problems with this. Let's check some.

#### Single table problems

Imagine that they decided to rename the "Sharp Tower" to "Preventers Tower".

Now we would have to update that in two places.

What happens if our code starts to update that name in one place and suddenly there's a power outage and the computer goes off?

We could end up with inconsistent information, having one place saying "Preventers Tower" and the other one saying "Sharp Tower":

<table>
<tr>
<th>id</th><th>name</th><th>secret_name</th><th>age</th><th>team</th><th>headquarters</th>
</tr>
<tr>
<td>1</td><td>Deadpond</td><td>Dive Wilson</td><td>null</td><td>Z-Force</td><td>Sister Margaret's Bar</td>
</tr>
<tr>
<td>2</td><td>Spider-Boy</td><td>Pedro Parqueador</td><td>null</td><td>Preventers</td><td>Preventers Tower ✅</td>
</tr>
<tr>
<td>3</td><td>Rusty-Man</td><td>Tommy Sharp</td><td>48</td><td>Preventers</td><td>Sharp Tower 🚨</td>
</tr>
</table>

And now imagine that we need to add a new hero called "Mahjong" that is part of the team "Z-Force".

We could forget the name of the team and end up adding "Mahjong" with an invalid team name, for example "Y-Force".

<table>
<tr>
<th>id</th><th>name</th><th>secret_name</th><th>age</th><th>team</th><th>headquarters</th>
</tr>
<tr>
<td>1</td><td>Deadpond</td><td>Dive Wilson</td><td>null</td><td>Z-Force</td><td>Sister Margaret's Bar</td>
</tr>
<tr>
<td>2</td><td>Spider-Boy</td><td>Pedro Parqueador</td><td>null</td><td>Preventers</td><td>Preventers Tower</td>
</tr>
<tr>
<td>3</td><td>Rusty-Man</td><td>Tommy Sharp</td><td>48</td><td>Preventers</td><td>Sharp Tower</td>
</tr>
<tr>
<td>4</td><td>Mahjong</td><td>Neena Thurgirl</td><td>31</td><td>Y-Force 🚨</td><td>Sister Margaret's Bar</td>
</tr>
</table>

And what if a single hero belongs to two teams? We wouldn't have an easy way to put this into a single big table.

### Multiple tables

But these and other problems could be solved better by having the data in multiple tables.

So, instead of having a single table with all the data, we could have one table for the heroes and one for teams, and a way to connect one with the other.

The table for the teams could look like this:

<table>
<tr>
<th>id</th><th>name</th><th>headquarters</th>
</tr>
<tr>
<td>1</td><td>Preventers</td><td>Sharp Tower</td>
</tr>
<tr>
<td>2</td><td>Z-Force</td><td>Sister Margaret's Bar</td>
</tr>
</table>

Now, the table for the heroes would look almost the same. But remember that we mentioned that we need a way to connect the two tables?

The table for the heroes would now have another column `team_id`. This column shows the relationship from each row (from each hero) to the team they belong to.

<table>
<tr>
<th>id</th><th>name</th><th>secret_name</th><th>age</th><th>team_id ✨</th>
</tr>
<tr>
<td>1</td><td>Deadpond</td><td>Dive Wilson</td><td>null</td><td>2 ✨</td>
</tr>
<tr>
<td>2</td><td>Spider-Boy</td><td>Pedro Parqueador</td><td>null</td><td>1 ✨</td>
</tr>
<tr>
<td>3</td><td>Rusty-Man</td><td>Tommy Sharp</td><td>48</td><td>1 ✨</td>
</tr>
</table>

#### Identifications - Primary Key

In the example above, each one of the rows has an <abbr title='abbreviated from the word "identification", in many cases written as "ID"'>`id`</abbr>. Each ID is unique per table and identifies that particular row.

These SQL databases require having a unique way to identify each row in a table. It could be a combination of columns that is unique, but commonly it is just one single column. This is called the "**primary key**" of the table.

The **primary key** is frequently a single column, commonly it's just an integer generated automatically by the database, and in many cases, the column is simply called `id`.

This **primary key**, in this case the column `id`, has to be unique per table. But two different tables could have the same ID. For example, above, both tables have the ID `2` for two different rows, one for "**Z-Force**" in one table and one for "**Spider-Boy**" in the other table, but that's still okay as long as there's a single one per table.

#### Relationships - Foreign Key

Each row in a table has a single **primary key** (in our example a single column `id`).

For example, the table for the teams has the ID `1` for the team `Preventers` and the ID `2` for the team `Z-Force`.

As these **primary key** IDs can uniquely identify each row on the table for teams, we can now go to the table for heroes and refer to those IDs in the table for teams.

![table relationships](img/databases/relationships.drawio.svg)

So, in the table for heroes, we use the `team_id` column to define a relationship to the *foreign* table for teams. Each value in the `team_id` column on the table with heroes will be the same value as the `id` column of one row in the table with teams.

In the table for heroes we have a **primary key** that is the `id`. But we also have another column `team_id` that refers to a **key** in a **foreign** table. There's a technical term for that too, the `team_id` is a "**foreign key**".

### Relations and Relational Databases

The technical and academic term for each one of these tables is a "**relation**".

You might hear that term a lot when talking about these databases.

It doesn't have the meaning that you would use in English of something being related to something else, even though each of these tables is actually "related" to the others.

The technical term **relation** just refers to each one of these tables.

And because of this technical term, these **SQL Databases** are also called **Relational Databases** (in fact, that is the technically correct term). But it still just refers to these databases made with multiple tables.

### SQL - The Language

After developing these ideas of how to store data in multiple tables they also created a **language** that could be used to interact with them.

The language is called **SQL**, the name comes from for **Structured Query Language**.

Nevertheless, the language is not only used to *query* for data. It is also used to create records/rows, to update them, to delete them. And to manipulate the database, create tables, etc.

This language is supported by all these databases that handle multiple tables, that's why they are called **SQL Databases**. Although, each database has small variations in the SQL language they support (*dialect*).

Let's imagine that the table holding the heroes is called the `hero` table. An example of a SQL query to get all the data from it could look like:

```SQL
SELECT *
FROM hero;
```

And that SQL query would return the table:

<table>
<tr>
<th>id</th><th>name</th><th>secret_name</th><th>age</th><th>team_id</th>
</tr>
<tr>
<td>1</td><td>Deadpond</td><td>Dive Wilson</td><td>null</td><td>2</td>
</tr>
<tr>
<td>2</td><td>Spider-Boy</td><td>Pedro Parqueador</td><td>null</td><td>1</td>
</tr>
<tr>
<td>3</td><td>Rusty-Man</td><td>Tommy Sharp</td><td>48</td><td>1</td>
</tr>
</table>

### SQLModel for SQL

**SQLModel** is a library that helps you write Python code with regular Python objects, and then it transfers that to **SQL** statements that it sends to a **SQL Database**.

Next, it receives the data and puts it in Python objects that you can continue to use in your code.

I'll tell you more about SQL, SQLModel, how to use them, and how they are related in the next sections.

/// info  | Technical Details

SQLModel is built on top of SQLAlchemy. It is, in fact, just <a href="https://www.sqlalchemy.org/" class="external-link" target="_blank">SQLAlchemy</a> and <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a> mixed together with some sugar on top.

///

## NoSQL Databases

Although SQL Databases are the oldest and most commonly used type of database, there's another (very interesting) category, the one of **NoSQL Databases**.

**NoSQL Databases** covers a wide range of different sub-types, including key-value stores, document stores, graph databases, and more.

**SQLModel** can only help you with SQL Databases. So, that's what we'll talk about in the rest of the documentation.


================================================
FILE: docs/db-to-code.md
================================================
# Database to Code (ORMs)

Here I'll tell you how **SQLModel** interacts with the database, why you would want to use it (or use a similar tool), and how it relates to SQL.

## SQL Inline in Code

Let's check this example of a simple SQL query to get all the data from the `hero` table:

```SQL
SELECT *
FROM hero;
```

And that SQL query would return the table:

<table>
<tr>
<th>id</th><th>name</th><th>secret_name</th><th>age</th><th>team_id</th>
</tr>
<tr>
<td>1</td><td>Deadpond</td><td>Dive Wilson</td><td>null</td><td>2</td>
</tr>
<tr>
<td>2</td><td>Spider-Boy</td><td>Pedro Parqueador</td><td>null</td><td>1</td>
</tr>
<tr>
<td>3</td><td>Rusty-Man</td><td>Tommy Sharp</td><td>48</td><td>1</td>
</tr>
</table>

This SQL language has a little **caveat**. It was not designed to be mixed with normal code in a programming language like Python. 🚨

So, if you are working with Python, the simplest option would be to put SQL code inside a string, and send that string directly to the database.

```Python
statement = "SELECT * FROM hero;"

results = database.execute(statement)
```

But in that case, you wouldn't have editor support, inline errors, autocompletion, etc. Because for the editor, the SQL statement is just a string of text. If you have an error, the editor wouldn't be able to help. 😔

And even more importantly, in most of the cases, you would send the SQL strings with modifications and parameters. For example, to get the data for a *specific item ID*, a *range of dates*, etc.

And in most cases, the parameters your code uses to query or modify the data in the database come, in some way, from an external user.

For example, check this SQL query:

```SQL
SELECT *
FROM hero
WHERE id = 2;
```

It is using the ID parameter `2`. That number `2` probably comes, in some way, from a user input.

The user is probably, in some way, telling your application:

> Hey, I want to get the hero with ID:

```SQL
2
```

And the result would be this table (with a single row):

<table>
<tr>
<th>id</th><th>name</th><th>secret_name</th><th>age</th><th>team_id</th>
</tr>
<tr>
<td>2</td><td>Spider-Boy</td><td>Pedro Parqueador</td><td>null</td><td>1</td>
</tr>
</table>

### SQL Injection

But let's say that your code takes whatever the external user provides and puts it inside the SQL string before sending it to the database. Something like this:

```Python
# Never do this! 🚨 Continue reading.

user_id = input("Type the user ID: ")

statement = f"SELECT * FROM hero WHERE id = {user_id};"

results = database.execute(statement)
```

If the external user is actually an attacker, they could send you a malicious SQL string that does something terrible like deleting all the records. That's called a "**SQL Injection**".

For example, imagine that this new attacker user says:

> Hey, I want to get the hero with ID:

```SQL
2; DROP TABLE hero
```

Then the code above that takes the user input and puts it in SQL would actually send this to the database:

```SQL
SELECT * FROM hero WHERE id = 2; DROP TABLE hero;
```

Check that section added at the end. That's another entire SQL statement:

```SQL
DROP TABLE hero;
```

That is how you tell the database in SQL to delete the entire table `hero`.

<a href="https://theuselessweb.site/nooooooooooooooo/" class="external-link" target="_blank">Nooooo!</a> We lost all the data in the `hero` table! 💥😱

### SQL Sanitization

The process of making sure that whatever the external user sends is safe to use in the SQL string is called **sanitization**.

It comes by default in **SQLModel** (thanks to SQLAlchemy). And many other similar tools would also provide that functionality among many other features.

Now you are ready for <a href="https://xkcd.com/327/" class="external-link" target="_blank">a  joke from xkcd</a>:

![Exploits of a Mom](https://imgs.xkcd.com/comics/exploits_of_a_mom.png)

## SQL with SQLModel

With **SQLModel**, instead of writing SQL statements directly, you use Python classes and objects to interact with the database.

For example, you could ask the database for the same hero with ID `2` with this code:

```Python
user_id = input("Type the user ID: ")

session.exec(
    select(Hero).where(Hero.id == user_id)
).all()
```

If the user provides this ID:

```SQL
2
```

...the result would be this table (with a single row):

<table>
<tr>
<th>id</th><th>name</th><th>secret_name</th><th>age</th><th>team_id</th>
</tr>
<tr>
<td>2</td><td>Spider-Boy</td><td>Pedro Parqueador</td><td>null</td><td>1</td>
</tr>
</table>

### Preventing SQL Injections

If the user is an attacker and tries to send this as the "ID":

```SQL
2; DROP TABLE hero
```

Then **SQLModel** will convert that to a literal string `"2; DROP TABLE hero"`.

And then, it will tell the SQL Database to try to find a record with that exact ID instead of injecting the attack.

The difference in the final SQL statement is subtle, but it changes the meaning completely:

```SQL
SELECT * FROM hero WHERE id = "2; DROP TABLE hero;";
```

/// tip

Notice the double quotes (`"`) making it a string instead of more raw SQL.

///

The database will not find any record with that ID:

```SQL
"2; DROP TABLE hero;"
```

Then the database will send an empty table as the result because it didn't find any record with that ID.

Then your code will continue to execute and calmly tell the user that it couldn't find anything.

But we never deleted the `hero` table. 🎉

/// info

Of course, there are also other ways to do SQL data sanitization without using a tool like **SQLModel**, but it's still a nice feature you get by default.

///

### Editor Support

Check that Python snippet above again.

Because we are using **standard Python classes and objects**, your editor will be able to provide you with autocompletion, inline errors, etc.

For example, let's say you wanted to query the database to find a hero based on the secret identity.

Maybe you don't remember how you named the column. Maybe it was:

* `secret_identity`?

...or was it:

* `secretidentity`?

...or:

* `private_name`?
* `secret_name`?
* `secretname`?

If you type that in SQL strings in your code, your editor **won't be able to help you**:

```SQL
statement = "SELECT * FROM hero WHERE secret_identity = 'Dive Wilson';"

results = database.execute(statement)
```

...your editor will see that as a **long string** with some text inside, and it will **not be able to autocomplete** or detect the error in `secret_identity`.

But if you use common Python classes and objects, your editor will be able to help you:

```Python
database.execute(
    select(Hero).where(Hero.secret_name == "Dive Wilson")
).all()
```

![](img/db-to-code/autocompletion01.png){class="shadow"}

## ORMs and SQL

These types of libraries like **SQLModel** (and of course, SQLAlchemy) that translate between SQL and code with classes and objects are called **ORMs**.

**ORM** means **Object-Relational Mapper**.

This is a very common term, but it also comes from quite technical and **academical** concepts 👩‍🎓:

* **Object**: refers to code with classes and instances, normally called "Object Oriented Programming", that's why the "**Object**" part.

For example this class is part of that **Object** Oriented Programming:

```Python
class Hero(SQLModel):
    id: int | None = Field(default=None, primary_key=True)
    name: str
    secret_name: str
    age: int | None = None
```

* **Relational**: refers to the **SQL Databases**. Remember that they are also called **Relational Databases**, because each of those tables is also called a "**relation**"? That's where the "**Relational**" comes from.

For example this **Relation** or table:

<table>
<tr>
<th>id</th><th>name</th><th>secret_name</th><th>age</th><th>team_id</th>
</tr>
<tr>
<td>1</td><td>Deadpond</td><td>Dive Wilson</td><td>null</td><td>2</td>
</tr>
<tr>
<td>2</td><td>Spider-Boy</td><td>Pedro Parqueador</td><td>null</td><td>1</td>
</tr>
<tr>
<td>3</td><td>Rusty-Man</td><td>Tommy Sharp</td><td>48</td><td>1</td>
</tr>
</table>

* **Mapper**: this comes from Math, when there's something that can convert from some set of things to another, that's called a "**mapping function**". That's where the **Mapper** comes from.

![Squares to Triangles Mapper](img/db-to-code/mapper.drawio.svg)

We could also write a **mapping function** in Python that converts from the *set of lowercase letters* to the *set of uppercase letters*, like this:

```Python
def map_lower_to_upper(value: str):
    return value.upper()
```

It's actually a simple idea with a very academic and mathematical name. 😅

So, an **ORM** is a library that translates from SQL to code, and from code to SQL. All using classes and objects.

There are many ORMs available apart from **SQLModel**, you can read more about some of them in [Alternatives, Inspiration and Comparisons](alternatives.md){.internal-link target=_blank}

## SQL Table Names

/// info  | Technical Background

This is a bit of boring background for SQL purists. Feel free to skip this section. 😉

///

When working with pure SQL, it's common to name the tables in plural. So, the table would be named `heroes` instead of `hero`, because it could contain multiple rows, each with one hero.

Nevertheless, **SQLModel** and many other similar tools can generate a table name automatically from your code, as you will see later in the tutorial.

But this name will be derived from a class name. And it's common practice to use **singular** names for classes (e.g. `class Hero`, instead of `class Heroes`). Using singular names for classes like `class Hero` also makes your code more intuitive.

You will see **your own code** a lot more than the internal table names, so it's probably better to keep the code/class convention than the SQL convention.

So, to keep things consistent, I'll keep using the same table names that **SQLModel** would have generated.

/// tip

You can also override the table name. You can read about it in the Advanced User Guide.

///


================================================
FILE: docs/environment-variables.md
================================================
# Environment Variables

Before we jump into code, let's cover a bit some of the **basics** that we'll need to understand how to work with Python (and programming) in general. Let's check a bit about **environment variables**.

/// tip

If you already know what "environment variables" are and how to use them, feel free to skip this.

///

An environment variable (also known as "**env var**") is a variable that lives **outside** of the Python code, in the **operating system**, and could be read by your Python code (or by other programs as well).

Environment variables could be useful for handling application **settings**, as part of the **installation** of Python, etc.

## Create and Use Env Vars

You can **create** and use environment variables in the **shell (terminal)**, without needing Python:

//// tab | Linux, macOS, Windows Bash

<div class="termy">

```console
// You could create an env var MY_NAME with
$ export MY_NAME="Wade Wilson"

// Then you could use it with other programs, like
$ echo "Hello $MY_NAME"

Hello Wade Wilson
```

</div>

////

//// tab | Windows PowerShell

<div class="termy">

```console
// Create an env var MY_NAME
$ $Env:MY_NAME = "Wade Wilson"

// Use it with other programs, like
$ echo "Hello $Env:MY_NAME"

Hello Wade Wilson
```

</div>

////

## Read env vars in Python

You could also create environment variables **outside** of Python, in the terminal (or with any other method), and then **read them in Python**.

For example you could have a file `main.py` with:

```Python hl_lines="3"
import os

name = os.getenv("MY_NAME", "World")
print(f"Hello {name} from Python")
```

/// tip

The second argument to <a href="https://docs.python.org/3.8/library/os.html#os.getenv" class="external-link" target="_blank">`os.getenv()`</a> is the default value to return.

If not provided, it's `None` by default, here we provide `"World"` as the default value to use.

///

Then you could call that Python program:

//// tab | Linux, macOS, Windows Bash

<div class="termy">

```console
// Here we don't set the env var yet
$ python main.py

// As we didn't set the env var, we get the default value

Hello World from Python

// But if we create an environment variable first
$ export MY_NAME="Wade Wilson"

// And then call the program again
$ python main.py

// Now it can read the environment variable

Hello Wade Wilson from Python
```

</div>

////

//// tab | Windows PowerShell

<div class="termy">

```console
// Here we don't set the env var yet
$ python main.py

// As we didn't set the env var, we get the default value

Hello World from Python

// But if we create an environment variable first
$ $Env:MY_NAME = "Wade Wilson"

// And then call the program again
$ python main.py

// Now it can read the environment variable

Hello Wade Wilson from Python
```

</div>

////

As environment variables can be set outside of the code, but can be read by the code, and don't have to be stored (committed to `git`) with the rest of the files, it's common to use them for configurations or **settings**.

You can also create an environment variable only for a **specific program invocation**, that is only available to that program, and only for its duration.

To do that, create it right before the program itself, on the same line:

<div class="termy">

```console
// Create an env var MY_NAME in line for this program call
$ MY_NAME="Wade Wilson" python main.py

// Now it can read the environment variable

Hello Wade Wilson from Python

// The env var no longer exists afterwards
$ python main.py

Hello World from Python
```

</div>

/// tip

You can read more about it at <a href="https://12factor.net/config" class="external-link" target="_blank">The Twelve-Factor App: Config</a>.

///

## Types and Validation

These environment variables can only handle **text strings**, as they are external to Python and have to be compatible with other programs and the rest of the system (and even with different operating systems, as Linux, Windows, macOS).

That means that **any value** read in Python from an environment variable **will be a `str`**, and any conversion to a different type or any validation has to be done in code.

## `PATH` Environment Variable

There is a **special** environment variable called **`PATH`** that is used by the operating systems (Linux, macOS, Windows) to find programs to run.

The value of the variable `PATH` is a long string that is made of directories separated by a colon `:` on Linux and macOS, and by a semicolon `;` on Windows.

For example, the `PATH` environment variable could look like this:

//// tab | Linux, macOS

```plaintext
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
```

This means that the system should look for programs in the directories:

* `/usr/local/bin`
* `/usr/bin`
* `/bin`
* `/usr/sbin`
* `/sbin`

////

//// tab | Windows

```plaintext
C:\Program Files\Python312\Scripts;C:\Program Files\Python312;C:\Windows\System32
```

This means that the system should look for programs in the directories:

* `C:\Program Files\Python312\Scripts`
* `C:\Program Files\Python312`
* `C:\Windows\System32`

////

When you type a **command** in the terminal, the operating system **looks for** the program in **each of those directories** listed in the `PATH` environment variable.

For example, when you type `python` in the terminal, the operating system looks for a program called `python` in the **first directory** in that list.

If it finds it, then it will **use it**. Otherwise it keeps looking in the **other directories**.

### Installing Python and Updating the `PATH`

When you install Python, you might be asked if you want to update the `PATH` environment variable.

//// tab | Linux, macOS

Let's say you install Python and it ends up in a directory `/opt/custompython/bin`.

If you say yes to update the `PATH` environment variable, then the installer will add `/opt/custompython/bin` to the `PATH` environment variable.

It could look like this:

```plaintext
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/custompython/bin
```

This way, when you type `python` in the terminal, the system will find the Python program in `/opt/custompython/bin` (the last directory) and use that one.

////

//// tab | Windows

Let's say you install Python and it ends up in a directory `C:\opt\custompython\bin`.

If you say yes to update the `PATH` environment variable, then the installer will add `C:\opt\custompython\bin` to the `PATH` environment variable.

```plaintext
C:\Program Files\Python312\Scripts;C:\Program Files\Python312;C:\Windows\System32;C:\opt\custompython\bin
```

This way, when you type `python` in the terminal, the system will find the Python program in `C:\opt\custompython\bin` (the last directory) and use that one.

////

This way, when you type `python` in the terminal, the system will find the Python program in `/opt/custompython/bin` (the last directory) and use that one.

So, if you type:

<div class="termy">

```console
$ python
```

</div>

//// tab | Linux, macOS

The system will **find** the `python` program in `/opt/custompython/bin` and run it.

It would be roughly equivalent to typing:

<div class="termy">

```console
$ /opt/custompython/bin/python
```

</div>

////

//// tab | Windows

The system will **find** the `python` program in `C:\opt\custompython\bin\python` and run it.

It would be roughly equivalent to typing:

<div class="termy">

```console
$ C:\opt\custompython\bin\python
```

</div>

////

This information will be useful when learning about [Virtual Environments](virtual-environments.md){.internal-link target=_blank}.

## Conclusion

With this you should have a basic understanding of what **environment variables** are and how to use them in Python.

You can also read more about them in the <a href="https://en.wikipedia.org/wiki/Environment_variable" class="external-link" target="_blank">Wikipedia for Environment Variable</a>.

In many cases it's not very obvious how environment variables would be useful and applicable right away. But they keep showing up in many different scenarios when you are developing, so it's good to know about them.

For example, you will need this information in the next section, about [Virtual Environments](virtual-environments.md).


================================================
FILE: docs/features.md
================================================
# Features

## Designed for **FastAPI**

**SQLModel** was created by the same <a href="https://tiangolo.com/" class="external-link" target="_blank">author</a> of FastAPI.

<a href="https://fastapi.tiangolo.com" target="_blank"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" style="width: 20%;"></a>

It follows the same design and ideas, and it was created to be the most intuitive way to interact with SQL databases in FastAPI applications.

Nevertheless, SQLModel is completely **independent** of FastAPI and can be used with any other type of application. You can still benefit from its features.

## Just Modern Python

It's all based on standard <abbr title="Currently supported versions of Python">modern **Python**</abbr> type annotations. No new syntax to learn. Just standard modern Python.

If you need a 2 minute refresher of how to use Python types (even if you don't use SQLModel or FastAPI), check the FastAPI tutorial section: <a href="https://fastapi.tiangolo.com/python-types/" class="external-link" target="_blank">Python types intro</a>.

You will also see a 20 seconds refresher on the section [Tutorial - User Guide: First Steps](tutorial/index.md){.internal-link target=_blank}.

## Editor support

**SQLModel** was designed to be easy and intuitive to use to ensure the best development experience, with autocompletion everywhere.

Here's how your editor might help you:

* in <a href="https://code.visualstudio.com/" class="external-link" target="_blank">Visual Studio Code</a>:

<img class="shadow" src="/img/index/autocompletion02.png">

* in <a href="https://www.jetbrains.com/pycharm/" class="external-link" target="_blank">PyCharm</a>:

<img class="shadow" src="/img/features/autocompletion01.png">

You will get completion for everything while writing the **minimum** amount of code.

You won't need to keep guessing the types of different attributes in your models, if they could be `None`, etc. Your editor will be able to help you with everything because **SQLModel** is based on **standard Python type annotations**.

**SQLModel** adopts <a href="https://peps.python.org/pep-0681/" class="external-link" target="_blank">PEP 681</a> for Python type annotations to ensure the **best developer experience**, so you will get inline errors and autocompletion even while creating new model instances.

<img class="shadow" src="/img/index/autocompletion01.png">

## Short

**SQLModel** has **sensible defaults** for everything, with **optional configurations** everywhere.

But by default, it all **"just works"**.

You can start with the simplest (and most intuitive) type annotations for your data.

And later, you can fine-tune everything with all the power of SQLAlchemy and Pydantic.

## Based on Pydantic

**SQLModel** is based on Pydantic and keeps the same design, syntax, and ideas.

Underneath, ✨ a **SQLModel** model is also a **Pydantic** model. ✨

There was a lot of research and effort dedicated to make it that way.

That means you get all of **Pydantic's features**, including automatic data **validation**, **serialization**, and **documentation**. You can use SQLModel in the same way you can use Pydantic.

You can even create SQLModel models that do *not* represent SQL tables. In that case, they would be **the same as Pydantic models**.

This is useful, in particular, because now you can create a SQL database model that *inherits* from another non-SQL model. You can use that to **reduce code duplication** a lot. It will also make your code more consistent, improve editor support, etc.

This makes it the perfect combination for working with SQL databases in **FastAPI** applications. 🚀

You will learn more about combining different models later in the tutorial.

## Based on SQLAlchemy

**SQLModel** is also based on SQLAlchemy and uses it for everything.

Underneath, ✨ a **SQLModel** model is also a **SQLAlchemy** model. ✨

There was **a lot** of research and effort dedicated to make it that way. In particular, there was a lot of effort and experimentation in making a single model be **both a SQLAlchemy model and a Pydantic** model at the same time.

That means that you get all the power, robustness, and certainty of SQLAlchemy, the <a href="https://lp.jetbrains.com/python-developers-survey-2024/#orms" class="external-link" target="_blank">most widely used database library in Python</a>.

**SQLModel** provides its own utilities to <abbr title="with type completion, type checks, etc.">improve the developer experience</abbr>, but underneath, it uses all of SQLAlchemy.

You can even **combine** SQLModel models with SQLAlchemy models.

SQLModel is designed to satisfy the **most common use cases** and to be as simple and convenient as possible for those cases, providing the best developer experience.

But when you have more exotic use cases that require more complex features, you can still plug SQLAlchemy directly into SQLModel and use all its features in your code.

## Tested

* 100% <abbr title="The amount of code that is automatically tested">test coverage</abbr> (currently 97%, reaching 100% in the coming days/weeks).
* 100% <abbr title="Python type annotations, with this your editor and external tools can give you better support">type annotated</abbr> code base.


================================================
FILE: docs/help.md
================================================
# Help SQLModel - Get Help

Do you like **SQLModel**?

Would you like to help SQLModel, other users, and the author?

Or would you like to get help with **SQLModel**?

There are very simple ways to help (several involve just one or two clicks).

And there are several ways to get help too.

## Subscribe to the FastAPI and Friends newsletter

You can subscribe to the (infrequent) <a href="https://fastapi.tiangolo.com/newsletter" class="external-link" target="_blank">**FastAPI and friends** newsletter</a> to stay updated about:

* News about FastAPI and friends, including SQLModel 🚀
* Guides 📝
* Features ✨
* Breaking changes 🚨
* Tips and tricks ✅

## Star **SQLModel** in GitHub

You can "star" SQLModel in GitHub (clicking the star button at the top right): <a href="https://github.com/fastapi/sqlmodel" class="external-link" target="_blank">https://github.com/fastapi/sqlmodel</a>. ⭐️

By adding a star, other users will be able to find it more easily and see that it has been already useful for others.

## Watch the GitHub repository for releases

You can "watch" SQLModel in GitHub (clicking the "watch" button at the top right): <a href="https://github.com/fastapi/sqlmodel" class="external-link" target="_blank">https://github.com/fastapi/sqlmodel</a>. 👀

There you can select "Releases only".

By doing it, you will receive notifications (in your email) whenever there's a new release (a new version) of **SQLModel** with bug fixes and new features.

## Connect with the author

You can connect with <a href="https://tiangolo.com" class="external-link" target="_blank">me (Sebastián Ramírez / `tiangolo`)</a>, the author.

You can:

* <a href="https://github.com/tiangolo" class="external-link" target="_blank">Follow me on **GitHub**</a>.
    * See other Open Source projects I have created that could help you.
    * Follow me to see when I create a new Open Source project.
* <a href="https://twitter.com/tiangolo" class="external-link" target="_blank">Follow me on **Twitter**</a>.
    * Tell me how you use SQLModel (I love to hear that).
    * Hear when I make announcements or release new tools.
* <a href="https://www.linkedin.com/in/tiangolo/" class="external-link" target="_blank">Connect with me on **Linkedin**</a>.
    * Hear when I make announcements or release new tools (although I use Twitter more often 🤷‍♂).
* Read what I write (or follow me) on <a href="https://dev.to/tiangolo" class="external-link" target="_blank">**Dev.to**</a> or <a href="https://medium.com/@tiangolo" class="external-link" target="_blank">**Medium**</a>.
    * Read other ideas, articles, and read about tools I have created.
    * Follow me to read when I publish something new.

## Tweet about **SQLModel**

<a href="https://twitter.com/compose/tweet?text=I'm loving SQLModel because... https://github.com/fastapi/sqlmodel cc: @tiangolo" class="external-link" target="_blank">Tweet about **SQLModel**</a> and let me and others know why you like it. 🎉

I love to hear about how **SQLModel** is being used, what you have liked in it, in which project/company are you using it, etc.

## Help others with questions in GitHub

You can try and help others with their questions in:

* <a href="https://github.com/fastapi/sqlmodel/discussions/categories/questions?discussions_q=category%3AQuestions+is%3Aunanswered" class="external-link" target="_blank">GitHub Discussions</a>
* <a href="https://github.com/fastapi/sqlmodel/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Aquestion+-label%3Aanswered+" class="external-link" target="_blank">GitHub Issues</a>

In many cases you might already know the answer for those questions. 🤓

Just remember, the most important point is: try to be kind. People come with their frustrations and in many cases don't ask in the best way, but try as best as you can to be kind. 🤗

The idea is for the **SQLModel** community to be kind and welcoming. At the same time, don't accept bullying or disrespectful behavior towards others. We have to take care of each other.

---

Here's how to help others with questions (in discussions or issues):

### Understand the question

* Check if you can understand what is the **purpose** and use case of the person asking.

* Then check if the question (the vast majority are questions) is **clear**.

* In many cases the question asked is about an imaginary solution from the user, but there might be a **better** one. If you can understand the problem and use case better, you might be able to suggest a better **alternative solution**.

* If you can't understand the question, ask for more **details**.

### Reproduce the problem

For most of the cases and most of the questions there's something related to the person's **original code**.

In many cases they will only copy a fragment of the code, but that's not enough to **reproduce the problem**.

* You can ask them to provide a <a href="https://stackoverflow.com/help/minimal-reproducible-example" class="external-link" target="_blank">minimal, reproducible, example</a>, that you can **copy-paste** and run locally to see the same error or behavior they are seeing, or to understand their use case better.

* If you are feeling too generous, you can try to **create an example** like that yourself, just based on the description of the problem. Just have in mind that this might take a lot of time and it might be better to ask them to clarify the problem first.

### Suggest solutions

* After being able to understand the question, you can give them a possible **answer**.

* In many cases, it's better to understand their **underlying problem or use case**, because there might be a better way to solve it than what they are trying to do.

### Ask to close

If they reply, there's a high chance you would have solved their problem, congrats, **you're a hero**! 🦸

* Now, if that solved their problem, you can ask them to:

    * In GitHub Discussions: mark the comment as the **answer**.
    * In GitHub Issues: **close** the issue**.

## Watch the GitHub repository

You can "watch" SQLModel in GitHub (clicking the "watch" button at the top right): <a href="https://github.com/fastapi/sqlmodel" class="external-link" target="_blank">https://github.com/fastapi/sqlmodel</a>. 👀

If you select "Watching" instead of "Releases only" you will receive notifications when someone creates a new issue or question. You can also specify that you only want to be notified about new issues, or discussions, or PRs, etc.

Then you can try and help them solve those questions.

## Ask Questions

You can <a href="https://github.com/fastapi/sqlmodel/discussions/new?category=questions" class="external-link" target="_blank">create a new question</a> in the GitHub repository, for example to:

* Ask a **question** or ask about a **problem**.
* Suggest a new **feature**.

**Note**: if you do it, then I'm going to ask you to also help others. 😉

## Review Pull Requests

You can help me review pull requests from others.

Again, please try your best to be kind. 🤗

---

Here's what to have in mind and how to review a pull request:

### Understand the problem

* First, make sure you **understand the problem** that the pull request is trying to solve. It might have a longer discussion in a GitHub Discussion or issue.

* There's also a good chance that the pull request is not actually needed because the problem can be solved in a **different way**. Then you can suggest or ask about that.

### Don't worry about style

* Don't worry too much about things like commit message styles, I will squash and merge customizing the commit manually.

* Also don't worry about style rules, there are already automatized tools checking that.

And if there's any other style or consistency need, I'll ask directly for that, or I'll add commits on top with the needed changes.

### Check the code

* Check and read the code, see if it makes sense, **run it locally** and see if it actually solves the problem.

* Then **comment** saying that you did that, that's how I will know you really checked it.

/// info

Unfortunately, I can't simply trust PRs that just have several approvals.

Several times it has happened that there are PRs with 3, 5 or more approvals, probably because the description is appealing, but when I check the PRs, they are actually broken, have a bug, or don't solve the problem they claim to solve. 😅

So, it's really important that you actually read and run the code, and let me know in the comments that you did. 🤓

///

* If the PR can be simplified in a way, you can ask for that, but there's no need to be too picky, there might be a lot of subjective points of view (and I will have my own as well 🙈), so it's better if you can focus on the fundamental things.

### Tests

* Help me check that the PR has **tests**.

* Check that the tests **fail** before the PR. 🚨

* Then check that the tests **pass** after the PR. ✅

* Many PRs don't have tests, you can **remind** them to add tests, or you can even **suggest** some tests yourself. That's one of the things that consume most time and you can help a lot with that.

* Then also comment what you tried, that way I'll know that you checked it. 🤓

## Create a Pull Request

You can [contribute](contributing.md){.internal-link target=_blank} to the source code with Pull Requests, for example:

* To fix a typo you found on the documentation.
* To propose new documentation sections.
* To fix an existing issue/bug.
    * Make sure to add tests.
* To add a new feature.
    * Make sure to add tests.
    * Make sure to add documentation if it's relevant.

## Help Maintain SQLModel

Help me maintain **SQLModel**! 🤓

There's a lot of work to do, and for most of it, **YOU** can do it.

The main tasks that you can do right now are:

* [Help others with questions in GitHub](#help-others-with-questions-in-github){.internal-link target=_blank} (see the section above).
* [Review Pull Requests](#review-pull-requests){.internal-link target=_blank} (see the section above).

Those two tasks are what **consume time the most**. That's the main work of maintaining SQLModel.

If you can help me with that, **you are helping me maintain SQLModel** and making sure it keeps **advancing faster and better**. 🚀

## Join the chat

Join the 👥 <a href="https://discord.gg/VQjSZaeJmf" class="external-link" target="_blank">FastAPI and Friends Discord chat server</a> 👥 and hang out with others in the community. There's a `#sqlmodel` channel.

/// tip

For questions, ask them in <a href="https://github.com/fastapi/sqlmodel/discussions/new?category=questions" class="external-link" target="_blank">GitHub Discussions</a>, there's a much better chance you will receive help there.

Use the chat only for other general conversations.

///

### Don't use the chat for questions

Have in mind that as chats allow more "free conversation", it's easy to ask questions that are too general and more difficult to answer, so, you might not receive answers.

In GitHub, the template will guide you to write the right question so that you can more easily get a good answer, or even solve the problem yourself even before asking. And in GitHub I can make sure I always answer everything, even if it takes some time. I can't personally do that with the chat. 😅

Conversations in the chat are also not as easily searchable as in GitHub, so questions and answers might get lost in the conversation.

On the other side, there are thousands of users in the chat, so there's a high chance you'll find someone to talk to there, almost all the time. 😄

## Sponsor the author

You can also financially support the author (me) through <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub sponsors</a>.

There you could buy me a coffee ☕️ to say thanks. 😄

## Sponsor the tools that power SQLModel

As you have seen in the documentation, SQLModel stands on the shoulders of giants, Pydantic and SQLAlchemy.

You can also sponsor:

* <a href="https://github.com/sponsors/samuelcolvin" class="external-link" target="_blank">Samuel Colvin (Pydantic)</a>
* <a href="https://github.com/sponsors/sqlalchemy" class="external-link" target="_blank">SQLAlchemy</a>

---

Thanks! 🚀


================================================
FILE: docs/index.md
================================================
<style>
.md-content .md-typeset h1 { display: none; }
</style>

<p align="center">
  <a href="https://sqlmodel.tiangolo.com"><img src="https://sqlmodel.tiangolo.com/img/logo-margin/logo-margin-vector.svg#only-light" alt="SQLModel"></a>
<!-- only-mkdocs -->
  <a href="https://sqlmodel.tiangolo.com"><img src="img/logo-margin/logo-margin-white-vector.svg#only-dark" alt="SQLModel"></a>
<!-- /only-mkdocs -->
</p>
<p align="center">
    <em>SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.</em>
</p>
<p align="center">
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3ATest+event%3Apush+branch%3Amain" target="_blank">
    <img src="https://github.com/fastapi/sqlmodel/actions/workflows/test.yml/badge.svg?event=push&branch=main" alt="Test">
</a>
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3APublish" target="_blank">
    <img src="https://github.com/fastapi/sqlmodel/actions/workflows/publish.yml/badge.svg" alt="Publish">
</a>
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/sqlmodel" target="_blank">
    <img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/sqlmodel.svg" alt="Coverage">
<a href="https://pypi.org/project/sqlmodel" target="_blank">
    <img src="https://img.shields.io/pypi/v/sqlmodel?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
</p>

---

**Documentation**: <a href="https://sqlmodel.tiangolo.com" target="_blank">https://sqlmodel.tiangolo.com</a>

**Source Code**: <a href="https://github.com/fastapi/sqlmodel" target="_blank">https://github.com/fastapi/sqlmodel</a>

---

SQLModel is a library for interacting with <abbr title='Also called "Relational databases"'>SQL databases</abbr> from Python code, with Python objects. It is designed to be intuitive, easy to use, highly compatible, and robust.

**SQLModel** is based on Python type annotations, and powered by <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a> and <a href="https://sqlalchemy.org/" class="external-link" target="_blank">SQLAlchemy</a>.

The key features are:

* **Intuitive to write**: Great editor support. <abbr title="also known as auto-complete, autocompletion, IntelliSense">Completion</abbr> everywhere. Less time debugging. Designed to be easy to use and learn. Less time reading docs.
* **Easy to use**: It has sensible defaults and does a lot of work underneath to simplify the code you write.
* **Compatible**: It is designed to be compatible with **FastAPI**, Pydantic, and SQLAlchemy.
* **Extensible**: You have all the power of SQLAlchemy and Pydantic underneath.
* **Short**: Minimize code duplication. A single type annotation does a lot of work. No need to duplicate models in SQLAlchemy and Pydantic.

## Sponsors

<!-- sponsors -->

{% if sponsors %}
{% for sponsor in sponsors.gold -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a>
{% endfor -%}
{%- for sponsor in sponsors.silver -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a>
{% endfor %}
{% endif %}

<!-- /sponsors -->

## SQL Databases in FastAPI

<a href="https://fastapi.tiangolo.com" target="_blank"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" style="width: 20%;"></a>

**SQLModel** is designed to simplify interacting with SQL databases in <a href="https://fastapi.tiangolo.com" class="external-link" target="_blank">FastAPI</a> applications, it was created by the same <a href="https://tiangolo.com/" class="external-link" target="_blank">author</a>. 😁

It 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.

**SQLModel** is, in fact, a thin layer on top of **Pydantic** and **SQLAlchemy**, carefully designed to be compatible with both.

## Requirements

A recent and currently supported <a href="https://www.python.org/downloads/" class="external-link" target="_blank">version of Python</a>.

As **SQLModel** is based on **Pydantic** and **SQLAlchemy**, it requires them. They will be automatically installed when you install SQLModel.

## Installation

Make sure you create a <a href="https://sqlmodel.tiangolo.com/virtual-environments/" class="external-link" target="_blank">virtual environment</a>, activate it, and then install SQLModel, for example with:

<div class="termy">

```console
$ pip install sqlmodel
---> 100%
Successfully installed sqlmodel
```

</div>

## Example

For an introduction to databases, SQL, and everything else, see the <a href="https://sqlmodel.tiangolo.com/databases/" target="_blank">SQLModel documentation</a>.

Here's a quick example. ✨

### A SQL Table

Imagine you have a SQL table called `hero` with:

* `id`
* `name`
* `secret_name`
* `age`

And you want it to have this data:

| id | name | secret_name | age |
-----|------|-------------|------|
| 1  | Deadpond | Dive Wilson | null |
| 2  | Spider-Boy | Pedro Parqueador | null |
| 3  | Rusty-Man | Tommy Sharp | 48 |

### Create a SQLModel Model

Then you could create a **SQLModel** model like this:

```Python
from sqlmodel import Field, SQLModel


class Hero(SQLModel, table=True):
    id: int | None = Field(default=None, primary_key=True)
    name: str
    secret_name: str
    age: int | None = None
```

That class `Hero` is a **SQLModel** model, the equivalent of a SQL table in Python code.

And each of those class attributes is equivalent to each **table column**.

### Create Rows

Then you could **create each row** of the table as an **instance** of the model:

```Python
hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson")
hero_2 = Hero(name="Spider-Boy", secret_name="Pedro Parqueador")
hero_3 = Hero(name="Rusty-Man", secret_name="Tommy Sharp", age=48)
```

This way, you can use conventional Python code with **classes** and **instances** that represent **tables** and **rows**, and that way communicate with the **SQL database**.

### Editor Support

Everything is designed for you to get the best developer experience possible, with the best editor support.

Including **autocompletion**:

<img class="shadow" src="https://sqlmodel.tiangolo.com/img/index/autocompletion01.png">

And **inline errors**:

<img class="shadow" src="https://sqlmodel.tiangolo.com/img/index/inline-errors01.png">

### Write to the Database

You 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:

```Python hl_lines="16  19  21-25"
from sqlmodel import Field, Session, SQLModel, create_engine


class Hero(SQLModel, table=True):
    id: int | None = Field(default=None, primary_key=True)
    name: str
    secret_name: str
    age: int | None = None


hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson")
hero_2 = Hero(name="Spider-Boy", secret_name="Pedro Parqueador")
hero_3 = Hero(name="Rusty-Man", secret_name="Tommy Sharp", age=48)


engine = create_engine("sqlite:///database.db")


SQLModel.metadata.create_all(engine)

with Session(engine) as session:
    session.add(hero_1)
    session.add(hero_2)
    session.add(hero_3)
    session.commit()
```

That will save a **SQLite** database with the 3 heroes.

### Select from the Database

Then you could write queries to select from that same database, for example with:

```Python hl_lines="13-17"
from sqlmodel import Field, Session, SQLModel, create_engine, select


class Hero(SQLModel, table=True):
    id: int | None = Field(default=None, primary_key=True)
    name: str
    secret_name: str
    age: int | None = None


engine = create_engine("sqlite:///database.db")

with Session(engine) as session:
    statement = select(Hero).where(Hero.name == "Spider-Boy")
    hero = session.exec(statement).first()
    print(hero)
```

### Editor Support Everywhere

**SQLModel** was carefully designed to give you the best developer experience and editor support, **even after selecting data** from the database:

<img class="shadow" src="https://sqlmodel.tiangolo.com/img/index/autocompletion02.png">

## SQLAlchemy and Pydantic

That class `Hero` is a **SQLModel** model.

But 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**.

And 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**.

## License

This project is licensed under the terms of the [MIT license](https://github.com/fastapi/sqlmodel/blob/main/LICENSE).


================================================
FILE: docs/install.md
================================================
# Install **SQLModel**

Create a project directory, create a [virtual environment](virtual-environments.md){.internal-link target=_blank}, activate it, and then install **SQLModel**, for example with:

<div class="termy">

```console
$ pip install sqlmodel
---> 100%
Successfully installed sqlmodel pydantic sqlalchemy
```

</div>

As **SQLModel** is built on top of <a href="https://www.sqlalchemy.org/" class="external-link" target="_blank">SQLAlchemy</a> and <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a>, when you install `sqlmodel` they will also be automatically installed.

## Install DB Browser for SQLite

Remember that [SQLite is a simple database in a single file](databases.md#a-single-file-database){.internal-link target=_blank}?

For most of the tutorial I'll use SQLite for the examples.

Python has integrated support for SQLite, it is a single file read and processed from Python. And it doesn't need an [External Database Server](databases.md#a-server-database){.internal-link target=_blank}, so it will be perfect for learning.

In fact, SQLite is perfectly capable of handling quite big applications. At some point you might want to migrate to a server-based database like <a href="https://www.postgresql.org/" class="external-link" target="_blank">PostgreSQL</a> (which is also free). But for now we'll stick to SQLite.

Through the tutorial I will show you SQL fragments, and Python examples. And I hope (and expect 🧐) you to actually run them, and verify that the database is working as expected and showing you the same data.

To be able to explore the SQLite file yourself, independent of Python code (and probably at the same time), I recommend you use <a href="https://sqlitebrowser.org/" class="external-link" target="_blank">DB Browser for SQLite</a>.

It's a great and simple program to interact with SQLite databases (SQLite files) in a nice user interface.

<img src="https://sqlitebrowser.org/images/screenshot.png">

Go ahead and <a href="https://sqlitebrowser.org/" class="external-link" target="_blank">Install DB Browser for SQLite</a>, it's free.

## Next Steps

Okay, let's get going! On the next section we'll start the [Tutorial - User Guide](tutorial/index.md). 🚀


================================================
FILE: docs/js/custom.js
================================================
function setupTermynal() {
    document.querySelectorAll(".use-termynal").forEach(node => {
        node.style.display = "block";
        new Termynal(node, {
            lineDelay: 500
        });
    });
    const progressLiteralStart = "---> 100%";
    const promptLiteralStart = "$ ";
    const customPromptLiteralStart = "# ";
    const termynalActivateClass = "termy";
    let termynals = [];

    function createTermynals() {
        document
            .querySelectorAll(`.${termynalActivateClass} .highlight code`)
            .forEach(node => {
                const text = node.textContent;
                const lines = text.split("\n");
                const useLines = [];
                let buffer = [];
                function saveBuffer() {
                    if (buffer.length) {
                        let isBlankSpace = true;
                        buffer.forEach(line => {
                            if (line) {
                                isBlankSpace = false;
                            }
                        });
                        dataValue = {};
                        if (isBlankSpace) {
                            dataValue["delay"] = 0;
                        }
                        if (buffer[buffer.length - 1] === "") {
                            // A last single <br> won't have effect
                            // so put an additional one
                            buffer.push("");
                        }
                        const bufferValue = buffer.join("<br>");
                        dataValue["value"] = bufferValue;
                        useLines.push(dataValue);
                        buffer = [];
                    }
                }
                for (let line of lines) {
                    if (line === progressLiteralStart) {
                        saveBuffer();
                        useLines.push({
                            type: "progress"
                        });
                    } else if (line.startsWith(promptLiteralStart)) {
                        saveBuffer();
                        const value = line.replace(promptLiteralStart, "").trimEnd();
                        useLines.push({
                            type: "input",
                            value: value
                        });
                    } else if (line.startsWith("// ")) {
                        saveBuffer();
                        const value = "💬 " + line.replace("// ", "").trimEnd();
                        useLines.push({
                            value: value,
                            class: "termynal-comment",
                            delay: 0
                        });
                    } else if (line.startsWith(customPromptLiteralStart)) {
                        saveBuffer();
                        const promptStart = line.indexOf(promptLiteralStart);
                        if (promptStart === -1) {
                            console.error("Custom prompt found but no end delimiter", line)
                        }
                        const prompt = line.slice(0, promptStart).replace(customPromptLiteralStart, "")
                        let value = line.slice(promptStart + promptLiteralStart.length);
                        useLines.push({
                            type: "input",
                            value: value,
                            prompt: prompt
                        });
                    } else {
                        buffer.push(line);
                    }
                }
                saveBuffer();
                const inputCommands = useLines.filter(line => line.type === "input").map(line => line.value).join("\n");
                node.textContent = inputCommands;
                const div = document.createElement("div");
                node.style.display = "none";
                node.after(div);
                const termynal = new Termynal(div, {
                    lineData: useLines,
                    noInit: true,
                    lineDelay: 500
                });
                termynals.push(termynal);
            });
    }

    function loadVisibleTermynals() {
        termynals = termynals.filter(termynal => {
            if (termynal.container.getBoundingClientRect().top - innerHeight <= 0) {
                termynal.init();
                return false;
            }
            return true;
        });
    }
    window.addEventListener("scroll", loadVisibleTermynals);
    createTermynals();
    loadVisibleTermynals();
}

function openLinksInNewTab() {
    const siteUrl = document.querySelector("link[rel='canonical']")?.href
        || window.location.origin;
    const siteOrigin = new URL(siteUrl).origin;
    document.querySelectorAll(".md-content a[href]").forEach(a => {
        if (a.getAttribute("target") === "_self") return;
        const href = a.getAttribute("href");
        if (!href) return;
        try {
            const url = new URL(href, window.location.href);
            // Skip same-page anchor links (only the hash differs)
            if (url.origin === window.location.origin
                && url.pathname === window.location.pathname
                && url.search === window.location.search) return;
            if (!a.hasAttribute("target")) {
                a.setAttribute("target", "_blank");
                a.setAttribute("rel", "noopener");
            }
            if (url.origin !== siteOrigin) {
                a.dataset.externalLink = "";
            } else {
                a.dataset.internalLink = "";
            }
        } catch (_) {}
    });
}

async function main() {
    setupTermynal();
    openLinksInNewTab();
}

document$.subscribe(() => {
    main()
})


================================================
FILE: docs/js/termynal.js
================================================
/**
 * termynal.js
 * A lightweight, modern and extensible animated terminal window, using
 * async/await.
 *
 * @author Ines Montani <ines@ines.io>
 * @version 0.0.1
 * @license MIT
 */

'use strict';

/** Generate a terminal widget. */
class Termynal {
    /**
     * Construct the widget's settings.
     * @param {(string|Node)=} container - Query selector or container element.
     * @param {Object=} options - Custom settings.
     * @param {string} options.prefix - Prefix to use for data attributes.
     * @param {number} options.startDelay - Delay before animation, in ms.
     * @param {number} options.typeDelay - Delay between each typed character, in ms.
     * @param {number} options.lineDelay - Delay between each line, in ms.
     * @param {number} options.progressLength - Number of characters displayed as progress bar.
     * @param {string} options.progressChar – Character to use for progress bar, defaults to █.
	 * @param {number} options.progressPercent - Max percent of progress.
     * @param {string} options.cursor – Character to use for cursor, defaults to ▋.
     * @param {Object[]} lineData - Dynamically loaded line data objects.
     * @param {boolean} options.noInit - Don't initialise the animation.
     */
    constructor(container = '#termynal', options = {}) {
        this.container = (typeof container === 'string') ? document.querySelector(container) : container;
        this.pfx = `data-${options.prefix || 'ty'}`;
        this.originalStartDelay = this.startDelay = options.startDelay
            || parseFloat(this.container.getAttribute(`${this.pfx}-startDelay`)) || 600;
        this.originalTypeDelay = this.typeDelay = options.typeDelay
            || parseFloat(this.container.getAttribute(`${this.pfx}-typeDelay`)) || 90;
        this.originalLineDelay = this.lineDelay = options.lineDelay
            || parseFloat(this.container.getAttribute(`${this.pfx}-lineDelay`)) || 1500;
        this.progressLength = options.progressLength
            || parseFloat(this.container.getAttribute(`${this.pfx}-progressLength`)) || 40;
        this.progressChar = options.progressChar
            || this.container.getAttribute(`${this.pfx}-progressChar`) || '█';
		this.progressPercent = options.progressPercent
            || parseFloat(this.container.getAttribute(`${this.pfx}-progressPercent`)) || 100;
        this.cursor = options.cursor
            || this.container.getAttribute(`${this.pfx}-cursor`) || '▋';
        this.lineData = this.lineDataToElements(options.lineData || []);
        this.loadLines()
        if (!options.noInit) this.init()
    }

    loadLines() {
        // Load all the lines and create the container so that the size is fixed
        // Otherwise it would be changing and the user viewport would be constantly
        // moving as she/he scrolls
        const finish = this.generateFinish()
        finish.style.visibility = 'hidden'
        this.container.appendChild(finish)
        // Appends dynamically loaded lines to existing line elements.
        this.lines = [...this.container.querySelectorAll(`[${this.pfx}]`)].concat(this.lineData);
        for (let line of this.lines) {
            line.style.visibility = 'hidden'
            this.container.appendChild(line)
        }
        const restart = this.generateRestart()
        restart.style.visibility = 'hidden'
        this.container.appendChild(restart)
        this.container.setAttribute('data-termynal', '');
    }

    /**
     * Initialise the widget, get lines, clear container and start animation.
     */
    init() {
        /**
         * Calculates width and height of Termynal container.
         * If container is empty and lines are dynamically loaded, defaults to browser `auto` or CSS.
         */
        const containerStyle = getComputedStyle(this.container);
        this.container.style.width = containerStyle.width !== '0px' ?
            containerStyle.width : undefined;
        this.container.style.minHeight = containerStyle.height !== '0px' ?
            containerStyle.height : undefined;

        this.container.setAttribute('data-termynal', '');
        this.container.innerHTML = '';
        for (let line of this.lines) {
            line.style.visibility = 'visible'
        }
        this.start();
    }

    /**
     * Start the animation and rener the lines depending on their data attributes.
     */
    async start() {
        this.addFinish()
        await this._wait(this.startDelay);

        for (let line of this.lines) {
            const type = line.getAttribute(this.pfx);
            const delay = line.getAttribute(`${this.pfx}-delay`) || this.lineDelay;

            if (type == 'input') {
                line.setAttribute(`${this.pfx}-cursor`, this.cursor);
                await this.type(line);
                await this._wait(delay);
            }

            else if (type == 'progress') {
                await this.progress(line);
                await this._wait(delay);
            }

            else {
                this.container.appendChild(line);
                await this._wait(delay);
            }

            line.removeAttribute(`${this.pfx}-cursor`);
        }
        this.addRestart()
        this.finishElement.style.visibility = 'hidden'
        this.lineDelay = this.originalLineDelay
        this.typeDelay = this.originalTypeDelay
        this.startDelay = this.originalStartDelay
    }

    generateRestart() {
        const restart = document.createElement('a')
        restart.onclick = (e) => {
            e.preventDefault()
            this.container.innerHTML = ''
            this.init()
        }
        restart.href = '#'
        restart.setAttribute('data-terminal-control', '')
        restart.innerHTML = "restart ↻"
        return restart
    }

    generateFinish() {
        const finish = document.createElement('a')
        finish.onclick = (e) => {
            e.preventDefault()
            this.lineDelay = 0
            this.typeDelay = 0
            this.startDelay = 0
        }
        finish.href = '#'
        finish.setAttribute('data-terminal-control', '')
        finish.innerHTML = "fast →"
        this.finishElement = finish
        return finish
    }

    addRestart() {
        const restart = this.generateRestart()
        this.container.appendChild(restart)
    }

    addFinish() {
        const finish = this.generateFinish()
        this.container.appendChild(finish)
    }

    /**
     * Animate a typed line.
     * @param {Node} line - The line element to render.
     */
    async type(line) {
        const chars = [...line.textContent];
        line.textContent = '';
        this.container.appendChild(line);

        for (let char of chars) {
            const delay = line.getAttribute(`${this.pfx}-typeDelay`) || this.typeDelay;
            await this._wait(delay);
            line.textContent += char;
        }
    }

    /**
     * Animate a progress bar.
     * @param {Node} line - The line element to render.
     */
    async progress(line) {
        const progressLength = line.getAttribute(`${this.pfx}-progressLength`)
            || this.progressLength;
        const progressChar = line.getAttribute(`${this.pfx}-progressChar`)
            || this.progressChar;
        const chars = progressChar.repeat(progressLength);
		const progressPercent = line.getAttribute(`${this.pfx}-progressPercent`)
			|| this.progressPercent;
        line.textContent = '';
        this.container.appendChild(line);

        for (let i = 1; i < chars.length + 1; i++) {
            await this._wait(this.typeDelay);
            const percent = Math.round(i / chars.length * 100);
            line.textContent = `${chars.slice(0, i)} ${percent}%`;
			if (percent>progressPercent) {
				break;
			}
        }
    }

    /**
     * Helper function for animation delays, called with `await`.
     * @param {number} time - Timeout, in ms.
     */
    _wait(time) {
        return new Promise(resolve => setTimeout(resolve, time));
    }

    /**
     * Converts line data objects into line elements.
     *
     * @param {Object[]} lineData - Dynamically loaded lines.
     * @param {Object} line - Line data object.
     * @returns {Element[]} - Array of line elements.
     */
    lineDataToElements(lineData) {
        return lineData.map(line => {
            let div = document.createElement('div');
            div.innerHTML = `<span ${this._attributes(line)}>${line.value || ''}</span>`;

            return div.firstElementChild;
        });
    }

    /**
     * Helper function for generating attributes string.
     *
     * @param {Object} line - Line data object.
     * @returns {string} - String of attributes.
     */
    _attributes(line) {
        let attrs = '';
        for (let prop in line) {
            // Custom add class
            if (prop === 'class') {
                attrs += ` class=${line[prop]} `
                continue
            }
            if (prop === 'type') {
                attrs += `${this.pfx}="${line[prop]}" `
            } else if (prop !== 'value') {
                attrs += `${this.pfx}-${prop}="${line[prop]}" `
            }
        }
        return attrs;
    }
}

/**
* HTML API: If current script has container(s) specified, initialise Termynal.
*/
if (document.currentScript.hasAttribute('data-termynal-container')) {
    const containers = document.currentScript.getAttribute('data-termynal-container');
    containers.split('|')
        .forEach(container => new Termynal(container))
}


================================================
FILE: docs/learn/index.md
================================================
# Learn

Learn how to use **SQLModel** here.

This includes an introduction to **databases**, **SQL**, how to interact with databases from **code** and more.

You could consider this a **book**, a **course**, and the **official** recommended way to learn **SQLModel**. 😎


================================================
FILE: docs/management-tasks.md
================================================
# Repository Management Tasks

These are the tasks that can be performed to manage the SQLModel repository by [team members](./management.md#team){.internal-link target=_blank}.

/// tip

This section is useful only to a handful of people, team members with permissions to manage the repository. You can probably skip it. 😉

///

...so, you are a [team member of SQLModel](./management.md#team){.internal-link target=_blank}? Wow, you are so cool! 😎

You can help with everything on [Help SQLModel - Get Help](./help.md){.internal-link target=_blank} the same ways as external contributors. But additionally, there are some tasks that only you (as part of the team) can perform.

Here are the general instructions for the tasks you can perform.

Thanks a lot for your help. 🙇

## Be Nice

First of all, be nice. 😊

You probably are super nice if you were added to the team, but it's worth mentioning it. 🤓

### When Things are Difficult

When things are great, everything is easier, so that doesn't need much instructions. But when things are difficult, here are some guidelines.

Try to find the good side. In general, if people are not being unfriendly, try to thank their effort and interest, even if you disagree with the main subject (discussion, PR), just thank them for being interested in the project, or for having dedicated some time to try to do something.

It's difficult to convey emotion in text, use emojis to help. 😅

In discussions and PRs, in many cases, people bring their frustration and show it without filter, in many cases exaggerating, complaining, being entitled, etc. That's really not nice, and when it happens, it lowers our priority to solve their problems. But still, try to breath, and be gentle with your answers.

Try to avoid using bitter sarcasm or potentially passive-aggressive comments. If something is wrong, it's better to be direct (try to be gentle) than sarcastic.

Try to be as specific and objective as possible, avoid generalizations.

For conversations that are more difficult, for example to reject a PR, you can ask me (@tiangolo) to handle it directly.

## Edit PR Titles

* Edit the PR title to start with an emoji from <a href="https://gitmoji.dev/" class="external-link" target="_blank">gitmoji</a>.
    * Use the emoji character, not the GitHub code. So, use `🐛` instead of `:bug:`. This is so that it shows up correctly outside of GitHub, for example in the release notes.
* Start the title with a verb. For example `Add`, `Refactor`, `Fix`, etc. This way the title will say the action that the PR does. Like `Add support for teleporting`, instead of `Teleporting wasn't working, so this PR fixes it`.
* Edit the text of the PR title to start in "imperative", like giving an order. So, instead of `Adding support for teleporting` use `Add support for teleporting`.
* Try to make the title descriptive about what it achieves. If it's a feature, try to describe it, for example `Add support for teleporting` instead of `Create TeleportAdapter class`.
* Do not finish the title with a period (`.`).

Once the PR is merged, a GitHub Action (<a href="https://github.com/tiangolo/latest-changes" class="external-link" target="_blank">latest-changes</a>) will use the PR title to update the latest changes automatically.

So, having a nice PR title will not only look nice in GitHub, but also in the release notes. 📝

## Add Labels to PRs

The same GitHub Action <a href="https://github.com/tiangolo/latest-changes" class="external-link" target="_blank">latest-changes</a> uses one label in the PR to decide the section in the release notes to put this PR in.

Make sure you use a supported label from the <a href="https://github.com/tiangolo/latest-changes#using-labels" class="external-link" target="_blank">latest-changes list of labels</a>:

* `breaking`: Breaking Changes
    * Existing code will break if they update the version without changing their code. This rarely happens, so this label is not frequently used.
* `security`: Security Fixes
    * This is for security fixes, like vulnerabilities. It would almost never be used.
* `feature`: Features
    * New features, adding support for things that didn't exist before.
* `bug`: Fixes
    * Something that was supported didn't work, and this fixes it. There are many PRs that claim to be bug fixes because the user is doing something in an unexpected way that is not supported, but they considered it what should be supported by default. Many of these are actually features or refactors. But in some cases there's an actual bug.
* `refactor`: Refactors
    * This is normally for changes to the internal code that don't change the behavior. Normally it improves maintainability, or enables future features, etc.
* `upgrade`: Upgrades
    * This is for upgrades to direct dependencies from the project, or extra optional dependencies, normally in `pyproject.toml`. So, things that would affect final users, they would end up receiving the upgrade in their code base once they update. But this is not for upgrades to internal dependencies used for development, testing, docs, etc. Those internal dependencies or GitHub Action versions should be marked as `internal`, not `upgrade`.
* `docs`: Docs
    * Changes in docs. This includes updating the docs, fixing typos. But it doesn't include changes to translations.
    * You can normally quickly detect it by going to the "Files changed" tab in the PR and checking if the updated file(s) starts with `docs/en/docs`. The original version of the docs is always in English, so in `docs/en/docs`.
* `internal`: Internal
    * Use this for changes that only affect how the repo is managed. For example upgrades to internal dependencies, changes in GitHub Actions or scripts, etc.

/// tip

Some tools like Dependabot, will add some labels, like `dependencies`, but have in mind that this label is not used by the `latest-changes` GitHub Action, so it won't be used in the release notes. Please make sure one of the labels above is added.

///

## Review PRs

* If a PR doesn't explain what it does or why, if it seems like it could be useful, ask for more information. Otherwise, feel free to close it.

* If a PR seems to be spam, meaningless, only to change statistics (to appear as "contributor") or similar, you can simply mark it as `invalid`, and it will be automatically closed.

* If a PR seems to be AI generated, and seems like reviewing it would take more time from you than the time it took to write the prompt, mark it as `maybe-ai`, and it will be automatically closed.

* A PR should have a specific use case that it is solving.

* If the PR is for a feature, it should have docs.
    * Unless it's a feature we want to discourage, like support for a corner case that we don't want users to use.
* The docs should include a source example file, not write Python directly in Markdown.
* If the source example(s) file can have different syntax for different Python versions, there should be different versions of the file, and they should be shown in tabs in the docs.
* There should be tests testing the source example.
* Before the PR is applied, the new tests should fail.
* After applying the PR, the new tests should pass.
* Coverage should stay at 100%.
* If you see the PR makes sense, or we discussed it and considered it should be accepted, you can add commits on top of the PR to tweak it, to add docs, tests, format, refactor, remove extra files, etc.
* Feel free to comment in the PR to ask for more information, to suggest changes, etc.
* Once you think the PR is ready, move it in the internal GitHub project for me to review it.

## Dependabot PRs

Dependabot will create PRs to update dependencies for several things, and those PRs all look similar, but some are way more delicate than others.

* If the PR is for a direct dependency, so, Dependabot is modifying `pyproject.toml` in the main dependencies, **don't merge it**. 😱 Let me check it first. There's a good chance that some additional tweaks or updates are needed.
* If the PR updates one of the internal dependencies, for example the group `dev` in `pyproject.toml`, or GitHub Action versions, if the tests are passing, the release notes (shown in a summary in the PR) don't show any obvious potential breaking change, you can merge it. 😎

## Mark GitHub Discussions Answers

When a question in GitHub Discussions has been answered, mark the answer by clicking "Mark as answer".

You can filter discussions by <a href="https://github.com/fastapi/sqlmodel/discussions/categories/questions?discussions_q=category:Questions+is:open+is:unanswered" class="external-link" target="_blank">`Questions` that are `Unanswered`</a>.


================================================
FILE: docs/management.md
================================================
# Repository Management

Here's a short description of how the SQLModel repository is managed and maintained.

## Owner

I, <a href="https://github.com/tiangolo" target="_blank">@tiangolo</a>, am the creator and owner of the SQLModel repository. 🤓

I normally give the final review to each PR before merging them. I make the final decisions on the project, I'm the <a href="https://en.wikipedia.org/wiki/Benevolent_dictator_for_life" class="external-link" target="_blank"><abbr title="Benevolent Dictator For Life">BDFL</abbr></a>. 😅

## Team

There's a team of people that help manage and maintain the project. 😎

They have different levels of permissions and [specific instructions](./management-tasks.md){.internal-link target=_blank}.

Some of the tasks they can perform include:

* Adding labels to PRs.
* Editing PR titles.
* Adding commits on top of PRs to tweak them.
* Mark answers in GitHub Discussions questions, etc.
* Merge some specific types of PRs.

Joining the team is by invitation only, and I could update or remove permissions, instructions, or membership.

### Team Members

This is the current list of team members. 😎

<div class="user-list user-list-center">
{% for user in members["members"] %}

<div class="user"><a href="https://github.com/{{ user.login }}" target="_blank"><div class="avatar-wrapper"><img src="https://github.com/{{ user.login }}.png"/></div><div class="title">@{{ user.login }}</div></a></div>
{% endfor %}

</div>

Additional to them, there's a large community of people helping each other and getting involved in the projects in different ways.

## External Contributions

External contributions are very welcome and appreciated, including answering questions, submitting PRs, etc. 🙇‍♂️

There are many ways to [help maintain SQLModel](./help.md){.internal-link target=_blank}.


================================================
FILE: docs/overrides/main.html
================================================
{% extends "base.html" %}


================================================
FILE: docs/release-notes.md
================================================
# Release Notes

## Latest Changes

### Fixes

* 🐛 Fix `tuple_` return type annotation. PR [#1639](https://github.com/fastapi/sqlmodel/pull/1639) by [@kakeruzoku](https://github.com/kakeruzoku).

### Docs

* 📝 Fix ambiguous phrasing regarding `HeroPublicWithTeam` model. PR [#1678](https://github.com/fastapi/sqlmodel/pull/1678) by [@berkaykrc](https://github.com/berkaykrc).
* 🔨 Handle external links `target=_blank` and CSS automatically in JS and CSS. PR [#1799](https://github.com/fastapi/sqlmodel/pull/1799) by [@tiangolo](https://github.com/tiangolo).
* 📝 Document `.in_()` method. PR [#619](https://github.com/fastapi/sqlmodel/pull/619) by [@masylum](https://github.com/masylum).
* 📝 Fix small typos in the documentation. PR [#1641](https://github.com/fastapi/sqlmodel/pull/1641) by [@svlandeg](https://github.com/svlandeg).

### Internal

* ⬆ Bump mkdocs-material from 9.7.5 to 9.7.6. PR [#1825](https://github.com/fastapi/sqlmodel/pull/1825) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.15.6 to 0.15.7. PR [#1826](https://github.com/fastapi/sqlmodel/pull/1826) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump prek from 0.3.5 to 0.3.6. PR [#1817](https://github.com/fastapi/sqlmodel/pull/1817) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 📌 Update internal dependency limits. PR [#1809](https://github.com/fastapi/sqlmodel/pull/1809) by [@svlandeg](https://github.com/svlandeg).
* ⬆ Bump ruff from 0.15.5 to 0.15.6. PR [#1814](https://github.com/fastapi/sqlmodel/pull/1814) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump cairosvg from 2.8.2 to 2.9.0. PR [#1813](https://github.com/fastapi/sqlmodel/pull/1813) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump dorny/paths-filter from 3 to 4. PR [#1812](https://github.com/fastapi/sqlmodel/pull/1812) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump black from 26.3.0 to 26.3.1. PR [#1811](https://github.com/fastapi/sqlmodel/pull/1811) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump mkdocs-material from 9.7.4 to 9.7.5. PR [#1808](https://github.com/fastapi/sqlmodel/pull/1808) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump prek from 0.3.4 to 0.3.5. PR [#1807](https://github.com/fastapi/sqlmodel/pull/1807) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump black from 26.1.0 to 26.3.0. PR [#1803](https://github.com/fastapi/sqlmodel/pull/1803) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.15.4 to 0.15.5. PR [#1801](https://github.com/fastapi/sqlmodel/pull/1801) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump mkdocs-material from 9.7.3 to 9.7.4. PR [#1797](https://github.com/fastapi/sqlmodel/pull/1797) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump sqlalchemy from 2.0.47 to 2.0.48. PR [#1793](https://github.com/fastapi/sqlmodel/pull/1793) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump prek from 0.3.3 to 0.3.4. PR [#1794](https://github.com/fastapi/sqlmodel/pull/1794) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump fastapi from 0.134.0 to 0.135.1. PR [#1795](https://github.com/fastapi/sqlmodel/pull/1795) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump fastapi from 0.133.1 to 0.134.0. PR [#1792](https://github.com/fastapi/sqlmodel/pull/1792) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.15.2 to 0.15.4. PR [#1790](https://github.com/fastapi/sqlmodel/pull/1790) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump actions/download-artifact from 7 to 8. PR [#1789](https://github.com/fastapi/sqlmodel/pull/1789) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump actions/upload-artifact from 6 to 7. PR [#1788](https://github.com/fastapi/sqlmodel/pull/1788) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump fastapi from 0.133.0 to 0.133.1. PR [#1787](https://github.com/fastapi/sqlmodel/pull/1787) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump mkdocs-material from 9.7.2 to 9.7.3. PR [#1782](https://github.com/fastapi/sqlmodel/pull/1782) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump fastapi from 0.132.0 to 0.133.0. PR [#1781](https://github.com/fastapi/sqlmodel/pull/1781) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump sqlalchemy from 2.0.46 to 2.0.47. PR [#1783](https://github.com/fastapi/sqlmodel/pull/1783) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump pytest from 8.4.2 to 9.0.2. PR [#1780](https://github.com/fastapi/sqlmodel/pull/1780) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump mkdocstrings[python] from 0.30.1 to 1.0.3. PR [#1776](https://github.com/fastapi/sqlmodel/pull/1776) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump typer from 0.23.2 to 0.24.1. PR [#1777](https://github.com/fastapi/sqlmodel/pull/1777) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.15.1 to 0.15.2. PR [#1779](https://github.com/fastapi/sqlmodel/pull/1779) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump fastapi from 0.129.0 to 0.132.0. PR [#1778](https://github.com/fastapi/sqlmodel/pull/1778) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Update all dependencies to use `griffelib` instead of `griffe`. PR [#1775](https://github.com/fastapi/sqlmodel/pull/1775) by [@svlandeg](https://github.com/svlandeg).
* ⬆ Bump mkdocs-material from 9.7.1 to 9.7.2. PR [#1764](https://github.com/fastapi/sqlmodel/pull/1764) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump pillow from 11.3.0 to 12.1.1. PR [#1770](https://github.com/fastapi/sqlmodel/pull/1770) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump pydantic-settings from 2.12.0 to 2.13.1. PR [#1771](https://github.com/fastapi/sqlmodel/pull/1771) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump fastapi from 0.128.8 to 0.129.0. PR [#1769](https://github.com/fastapi/sqlmodel/pull/1769) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump black from 25.12.0 to 26.1.0. PR [#1768](https://github.com/fastapi/sqlmodel/pull/1768) by [@dependabot[bot]](https://github.com/apps/dependabot).

## 0.0.37

### Internal

* 👷 Fix build CI to not attempt to build `sqlmodel-slim`. PR [#1773](https://github.com/fastapi/sqlmodel/pull/1773) by [@tiangolo](https://github.com/tiangolo).

## 0.0.36

### Internal

* ➖ Drop support for `sqlmodel-slim`, no more versions will be released, use only `sqmodel`. PR [#1772](https://github.com/fastapi/sqlmodel/pull/1772) by [@tiangolo](https://github.com/tiangolo).

## 0.0.35

### Breaking Changes

* ➖ Drop support for Python 3.9. PR [#1766](https://github.com/fastapi/sqlmodel/pull/1766) by [@tiangolo](https://github.com/tiangolo).

### Internal

* 🔨 Add script to remove Python 3.9 files, migrate to Python 3.10. PR [#1767](https://github.com/fastapi/sqlmodel/pull/1767) by [@tiangolo](https://github.com/tiangolo).
* ⬆ Bump prek from 0.3.2 to 0.3.3. PR [#1761](https://github.com/fastapi/sqlmodel/pull/1761) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump typer from 0.23.1 to 0.23.2. PR [#1760](https://github.com/fastapi/sqlmodel/pull/1760) by [@dependabot[bot]](https://github.com/apps/dependabot).

## 0.0.34

### Internal

* 👷 Enable tests with lower and upper bound versions. PR [#1735](https://github.com/fastapi/sqlmodel/pull/1735) by [@tiangolo](https://github.com/tiangolo).
* ⬆ Bump ruff from 0.15.0 to 0.15.1. PR [#1758](https://github.com/fastapi/sqlmodel/pull/1758) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump typer from 0.23.0 to 0.23.1. PR [#1759](https://github.com/fastapi/sqlmodel/pull/1759) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump typer from 0.21.2 to 0.23.0. PR [#1756](https://github.com/fastapi/sqlmodel/pull/1756) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump fastapi from 0.128.7 to 0.128.8. PR [#1755](https://github.com/fastapi/sqlmodel/pull/1755) by [@dependabot[bot]](https://github.com/apps/dependabot).

## 0.0.33

### Docs

* ✏️ Fix typos in inline comment in `expression.py`. PR [#1747](https://github.com/fastapi/sqlmodel/pull/1747) by [@veeceey](https://github.com/veeceey).
* 📝 Fix async example in `session.execute()` docstring & deprecation message. PR [#1643](https://github.com/fastapi/sqlmodel/pull/1643) by [@DanielLeviLucas](https://github.com/DanielLeviLucas).
* 📝 Update `management-tasks.md` to be in line with `management-tasks.md` in FastAPI repo. PR [#1743](https://github.com/fastapi/sqlmodel/pull/1743) by [@YuriiMotov](https://github.com/YuriiMotov).

### Internal

* 🔨 Update build script for `sqlmodel-slim`. PR [#1754](https://github.com/fastapi/sqlmodel/pull/1754) by [@tiangolo](https://github.com/tiangolo).
* ⬆ Bump fastapi from 0.128.6 to 0.128.7. PR [#1751](https://github.com/fastapi/sqlmodel/pull/1751) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump typer from 0.21.1 to 0.21.2. PR [#1752](https://github.com/fastapi/sqlmodel/pull/1752) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 👷 Update build setup for `sqlmodel-slim`, deprecate it, and make it only depend on `sqlmodel`. PR [#1753](https://github.com/fastapi/sqlmodel/pull/1753) by [@tiangolo](https://github.com/tiangolo).
* ⬆ Bump fastapi from 0.128.3 to 0.128.6. PR [#1750](https://github.com/fastapi/sqlmodel/pull/1750) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump fastapi from 0.128.1 to 0.128.3. PR [#1746](https://github.com/fastapi/sqlmodel/pull/1746) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump prek from 0.3.1 to 0.3.2. PR [#1745](https://github.com/fastapi/sqlmodel/pull/1745) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump fastapi from 0.128.0 to 0.128.1. PR [#1742](https://github.com/fastapi/sqlmodel/pull/1742) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ✅ Update `ValidationError` schema in FastAPI-related tests to be compatible with FastAPI 0.128.1+. PR [#1744](https://github.com/fastapi/sqlmodel/pull/1744) by [@YuriiMotov](https://github.com/YuriiMotov).
* ⬆ Bump ruff from 0.14.14 to 0.15.0. PR [#1740](https://github.com/fastapi/sqlmodel/pull/1740) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 👷 Add generate-readme to pre-commit. PR [#1741](https://github.com/fastapi/sqlmodel/pull/1741) by [@tiangolo](https://github.com/tiangolo).
* 👷 Run mypy by pre-commit. PR [#1738](https://github.com/fastapi/sqlmodel/pull/1738) by [@YuriiMotov](https://github.com/YuriiMotov).
* ⬆ Bump prek from 0.3.0 to 0.3.1. PR [#1739](https://github.com/fastapi/sqlmodel/pull/1739) by [@dependabot[bot]](https://github.com/apps/dependabot).

## 0.0.32

### Fixes

* 🐛 Fix support for `Annotated` fields with Pydantic 2.12+. PR [#1607](https://github.com/fastapi/sqlmodel/pull/1607) by [@vimota](https://github.com/vimota).

### Refactors

* ♻️ Import `Literal` from the `typing` module directly. PR [#1699](https://github.com/fastapi/sqlmodel/pull/1699) by [@svlandeg](https://github.com/svlandeg).

### Docs

* 📝 Add contribution instructions about LLM generated code and comments and automated tools for PRs. PR [#1712](https://github.com/fastapi/sqlmodel/pull/1712) by [@alejsdev](https://github.com/alejsdev).
* 🐛 Fix copy button in `custom.js`. PR [#1711](https://github.com/fastapi/sqlmodel/pull/1711) by [@alejsdev](https://github.com/alejsdev).
* 📝 Remove duplicated word in `read-relationships.md`. PR [#1705](https://github.com/fastapi/sqlmodel/pull/1705) by [@stefmolin](https://github.com/stefmolin).

### Internal

* ⬆ Bump ruff from 0.14.13 to 0.14.14. PR [#1721](https://github.com/fastapi/sqlmodel/pull/1721) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump prek from 0.2.30 to 0.3.0. PR [#1720](https://github.com/fastapi/sqlmodel/pull/1720) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 🔧 Ensure that an edit to `uv.lock` gets the `internal` label. PR [#1719](https://github.com/fastapi/sqlmodel/pull/1719) by [@svlandeg](https://github.com/svlandeg).
* ⬆ Bump sqlalchemy from 2.0.45 to 2.0.46. PR [#1717](https://github.com/fastapi/sqlmodel/pull/1717) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump typer from 0.21.0 to 0.21.1. PR [#1715](https://github.com/fastapi/sqlmodel/pull/1715) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.14.10 to 0.14.13. PR [#1714](https://github.com/fastapi/sqlmodel/pull/1714) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump prek from 0.2.25 to 0.2.30. PR [#1716](https://github.com/fastapi/sqlmodel/pull/1716) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆️ Update FastAPI version pin to `>=0.103.2` in tests. PR [#1709](https://github.com/fastapi/sqlmodel/pull/1709) by [@YuriiMotov](https://github.com/YuriiMotov).
* 📌 Pin development Python version to 3.10, for `deploy_docs_status.py`. PR [#1707](https://github.com/fastapi/sqlmodel/pull/1707) by [@tiangolo](https://github.com/tiangolo).
* ⬆️  Migrate to uv. PR [#1688](https://github.com/fastapi/sqlmodel/pull/1688) by [@DoctorJohn](https://github.com/DoctorJohn).
* ⬆ Update fastapi requirement from >=0.103.2,<0.126.0 to >=0.103.2,<0.129.0. PR [#1703](https://github.com/fastapi/sqlmodel/pull/1703) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ✅ Update tests, remove conditionals for Pydantic v1. PR [#1702](https://github.com/fastapi/sqlmodel/pull/1702) by [@tiangolo](https://github.com/tiangolo).

## 0.0.31

### Breaking Changes

* ➖ Drop support for Pydantic v1. PR [#1701](https://github.com/fastapi/sqlmodel/pull/1701) by [@tiangolo](https://github.com/tiangolo).

### Internal

* ⬆ Bump dirty-equals from 0.9.0 to 0.11. PR [#1649](https://github.com/fastapi/sqlmodel/pull/1649) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump mkdocs-material from 9.7.0 to 9.7.1. PR [#1690](https://github.com/fastapi/sqlmodel/pull/1690) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump typer from 0.20.1 to 0.21.0. PR [#1694](https://github.com/fastapi/sqlmodel/pull/1694) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 📌 Relax `prek` version pin to `>=0.2.24,<1.0.0`. PR [#1698](https://github.com/fastapi/sqlmodel/pull/1698) by [@YuriiMotov](https://github.com/YuriiMotov).

## 0.0.30

### Breaking Changes

* ➖ Drop support for Python 3.8. PR [#1696](https://github.com/fastapi/sqlmodel/pull/1696) by [@tiangolo](https://github.com/tiangolo).

### Docs

* ➖ Drop support for Python 3.8 in CI and docs. PR [#1695](https://github.com/fastapi/sqlmodel/pull/1695) by [@YuriiMotov](https://github.com/YuriiMotov) and [@tiangolo](https://github.com/tiangolo).

### Internal

* 🔧 Update pre-commit, generate select on pre-commit, use local Ruff. PR [#1697](https://github.com/fastapi/sqlmodel/pull/1697) by [@tiangolo](https://github.com/tiangolo).
* ⬆ Bump actions/checkout from 5 to 6. PR [#1692](https://github.com/fastapi/sqlmodel/pull/1692) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 👷 Add pre-commit workflow. PR [#1684](https://github.com/fastapi/sqlmodel/pull/1684) by [@YuriiMotov](https://github.com/YuriiMotov).
* ✅ Simplify tests for code examples, one test file for multiple variants. PR [#1664](https://github.com/fastapi/sqlmodel/pull/1664) by [@YuriiMotov](https://github.com/YuriiMotov).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1677](https://github.com/fastapi/sqlmodel/pull/1677) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump actions/download-artifact from 6 to 7. PR [#1676](https://github.com/fastapi/sqlmodel/pull/1676) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump actions/cache from 4 to 5. PR [#1673](https://github.com/fastapi/sqlmodel/pull/1673) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump markdown-include-variants from 0.0.5 to 0.0.8. PR [#1674](https://github.com/fastapi/sqlmodel/pull/1674) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump actions/upload-artifact from 5 to 6. PR [#1675](https://github.com/fastapi/sqlmodel/pull/1675) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump mypy from 1.18.2 to 1.19.1. PR [#1679](https://github.com/fastapi/sqlmodel/pull/1679) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump typer from 0.20.0 to 0.20.1. PR [#1685](https://github.com/fastapi/sqlmodel/pull/1685) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.14.8 to 0.14.10. PR [#1681](https://github.com/fastapi/sqlmodel/pull/1681) by [@dependabot[bot]](https://github.com/apps/dependabot).

## 0.0.29

### Fixes

* 🐛 Fix `alias` support for Pydantic v2. PR [#1577](https://github.com/fastapi/sqlmodel/pull/1577) by [@ravishan16](https://github.com/ravishan16).

## 0.0.28

### Fixes

* 🐛 Fix `RuntimeError: dictionary changed size during iteration` in `sqlmodel_update()`. PR [#997](https://github.com/fastapi/sqlmodel/pull/997) by [@BartSchuurmans](https://github.com/BartSchuurmans).

### Docs

* 💅 Update CSS to explicitly use emoji font. PR [#1658](https://github.com/fastapi/sqlmodel/pull/1658) by [@tiangolo](https://github.com/tiangolo).
* 📝 Update link to JetBrains Python survey in `features.md`. PR [#1627](https://github.com/fastapi/sqlmodel/pull/1627) by [@sparkiegeek](https://github.com/sparkiegeek).
* 📝 Fix broken links in docs. PR [#1601](https://github.com/fastapi/sqlmodel/pull/1601) by [@YuriiMotov](https://github.com/YuriiMotov).

### Internal

* 📌 Pin FastAPI in tests to 0.125.0 while dropping support for Python 3.8. PR [#1689](https://github.com/fastapi/sqlmodel/pull/1689) by [@tiangolo](https://github.com/tiangolo).
* 👷 Configure coverage, error on main tests, don't wait for Smokeshow. PR [#1683](https://github.com/fastapi/sqlmodel/pull/1683) by [@YuriiMotov](https://github.com/YuriiMotov).
* 👷 Run Smokeshow always, even on test failures. PR [#1682](https://github.com/fastapi/sqlmodel/pull/1682) by [@YuriiMotov](https://github.com/YuriiMotov).
* ⬆ Bump ruff from 0.14.6 to 0.14.8. PR [#1667](https://github.com/fastapi/sqlmodel/pull/1667) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1662](https://github.com/fastapi/sqlmodel/pull/1662) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump actions/checkout from 5 to 6. PR [#1656](https://github.com/fastapi/sqlmodel/pull/1656) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.14.5 to 0.14.6. PR [#1652](https://github.com/fastapi/sqlmodel/pull/1652) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1655](https://github.com/fastapi/sqlmodel/pull/1655) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump actions/checkout from 5 to 6. PR [#1651](https://github.com/fastapi/sqlmodel/pull/1651) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 💄 Use font Fira Code to fix display of Rich panels in docs in Windows. PR [#1653](https://github.com/fastapi/sqlmodel/pull/1653) by [@tiangolo](https://github.com/tiangolo).
* 👷 Upgrade `latest-changes` GitHub Action and pin `actions/checkout@v5`. PR [#1654](https://github.com/fastapi/sqlmodel/pull/1654) by [@svlandeg](https://github.com/svlandeg).
* 🔧 Upgrade Material for MkDocs and remove insiders. PR [#1650](https://github.com/fastapi/sqlmodel/pull/1650) by [@tiangolo](https://github.com/tiangolo).
* ⬆ Bump mkdocs-material from 9.6.23 to 9.7.0. PR [#1645](https://github.com/fastapi/sqlmodel/pull/1645) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump mkdocs-macros-plugin from 1.4.1 to 1.5.0. PR [#1647](https://github.com/fastapi/sqlmodel/pull/1647) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.14.4 to 0.14.5. PR [#1646](https://github.com/fastapi/sqlmodel/pull/1646) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1648](https://github.com/fastapi/sqlmodel/pull/1648) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump ruff from 0.14.3 to 0.14.4. PR [#1640](https://github.com/fastapi/sqlmodel/pull/1640) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1642](https://github.com/fastapi/sqlmodel/pull/1642) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump mkdocs-material from 9.6.22 to 9.6.23. PR [#1637](https://github.com/fastapi/sqlmodel/pull/1637) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.14.2 to 0.14.3. PR [#1633](https://github.com/fastapi/sqlmodel/pull/1633) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1636](https://github.com/fastapi/sqlmodel/pull/1636) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump mkdocs-macros-plugin from 1.4.0 to 1.4.1. PR [#1626](https://github.com/fastapi/sqlmodel/pull/1626) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.14.1 to 0.14.2. PR [#1616](https://github.com/fastapi/sqlmodel/pull/1616) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1625](https://github.com/fastapi/sqlmodel/pull/1625) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* 🔧 Add PEP-639 license metadata. PR [#1624](https://github.com/fastapi/sqlmodel/pull/1624) by [@svlandeg](https://github.com/svlandeg).
* ⬆ Bump griffe-typingdoc from 0.2.9 to 0.3.0. PR [#1615](https://github.com/fastapi/sqlmodel/pull/1615) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump actions/upload-artifact from 4 to 5. PR [#1620](https://github.com/fastapi/sqlmodel/pull/1620) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump actions/download-artifact from 5 to 6. PR [#1621](https://github.com/fastapi/sqlmodel/pull/1621) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.14.0 to 0.14.1. PR [#1614](https://github.com/fastapi/sqlmodel/pull/1614) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.13.2 to 0.14.0. PR [#1592](https://github.com/fastapi/sqlmodel/pull/1592) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1605](https://github.com/fastapi/sqlmodel/pull/1605) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump astral-sh/setup-uv from 6 to 7. PR [#1593](https://github.com/fastapi/sqlmodel/pull/1593) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump mkdocs-material from 9.6.21 to 9.6.22. PR [#1608](https://github.com/fastapi/sqlmodel/pull/1608) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 🔧 Configure reminder for `waiting` label in `issue-manager`. PR [#1609](https://github.com/fastapi/sqlmodel/pull/1609) by [@YuriiMotov](https://github.com/YuriiMotov).
* ⬆ Bump typer from 0.19.2 to 0.20.0. PR [#1612](https://github.com/fastapi/sqlmodel/pull/1612) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ✅ Remove unused type ignores since SQLAlchemy 2.0.44. PR [#1613](https://github.com/fastapi/sqlmodel/pull/1613) by [@svlandeg](https://github.com/svlandeg).

## 0.0.27

### Upgrades

* ⬆️ Add support for Python 3.14. PR [#1578](https://github.com/fastapi/sqlmodel/pull/1578) by [@svlandeg](https://github.com/svlandeg).

## 0.0.26

### Fixes

* 🐛 Fix attribute handling in `model_dump` for compatibility with the latest Pydantic versions. PR [#1595](https://github.com/fastapi/sqlmodel/pull/1595) by [@spazm](https://github.com/spazm).

### Docs

* 📝 Fix typo in `docs/tutorial/fastapi/simple-hero-api.md`. PR [#1583](https://github.com/fastapi/sqlmodel/pull/1583) by [@kofi-kusi](https://github.com/kofi-kusi).

### Internal

* ⬆ Bump mypy from 1.4.1 to 1.18.2. PR [#1560](https://github.com/fastapi/sqlmodel/pull/1560) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ✅ Add test that runs select with 3 or 4 arguments. PR [#1590](https://github.com/fastapi/sqlmodel/pull/1590) by [@svlandeg](https://github.com/svlandeg).
* ⬆ Bump mkdocs-macros-plugin from 1.3.9 to 1.4.0. PR [#1581](https://github.com/fastapi/sqlmodel/pull/1581) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump mkdocs-material from 9.6.20 to 9.6.21. PR [#1588](https://github.com/fastapi/sqlmodel/pull/1588) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1584](https://github.com/fastapi/sqlmodel/pull/1584) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump tiangolo/issue-manager from 0.5.1 to 0.6.0. PR [#1589](https://github.com/fastapi/sqlmodel/pull/1589) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 👷 Update docs previews comment, single comment, add failure status. PR [#1586](https://github.com/fastapi/sqlmodel/pull/1586) by [@tiangolo](https://github.com/tiangolo).
* ⬆ Bump markdown-include-variants from 0.0.4 to 0.0.5. PR [#1582](https://github.com/fastapi/sqlmodel/pull/1582) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump typing-extensions from 4.13.2 to 4.15.0 for Python 3.9+. PR [#1580](https://github.com/fastapi/sqlmodel/pull/1580) by [@svlandeg](https://github.com/svlandeg).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1571](https://github.com/fastapi/sqlmodel/pull/1571) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump typer from 0.17.4 to 0.19.2. PR [#1573](https://github.com/fastapi/sqlmodel/pull/1573) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.13.0 to 0.13.2. PR [#1576](https://github.com/fastapi/sqlmodel/pull/1576) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 💚 Fix CI test suite for Windows and MacOS. PR [#1307](https://github.com/fastapi/sqlmodel/pull/1307) by [@svlandeg](https://github.com/svlandeg).

## 0.0.25

### Features

* ✨ Add overload for `exec` method to support `insert`, `update`, `delete` statements. PR [#1342](https://github.com/fastapi/sqlmodel/pull/1342) by [@seriaati](https://github.com/seriaati).

### Upgrades

* ⬆️ Drop support for Python 3.7, require Python 3.8 or above. PR [#1316](https://github.com/fastapi/sqlmodel/pull/1316) by [@svlandeg](https://github.com/svlandeg).

### Docs

* ✏️ Fix typos in `docs/tutorial/relationship-attributes/cascade-delete-relationships.md`. PR [#1543](https://github.com/fastapi/sqlmodel/pull/1543) by [@YuriiMotov](https://github.com/YuriiMotov).
* 🍱 Update SVG files, a single file per diagram, sans-serif fonts. PR [#1373](https://github.com/fastapi/sqlmodel/pull/1373) by [@tiangolo](https://github.com/tiangolo).
* 📝 Grammar tweak in `docs/tutorial/insert.md`. PR [#1368](https://github.com/fastapi/sqlmodel/pull/1368) by [@brettcannon](https://github.com/brettcannon).
* 📝 Update `docs/tutorial/fastapi/relationships.md`. PR [#1365](https://github.com/fastapi/sqlmodel/pull/1365) by [@Foxerine](https://github.com/Foxerine).
* ✏️ Tweak the grammar in `docs/learn/index.md`. PR [#1363](https://github.com/fastapi/sqlmodel/pull/1363) by [@brettcannon](https://github.com/brettcannon).
* 📝 Update all docs references to `Optional` to use the new syntax in Python 3.10, e.g. `int | None`. PR [#1351](https://github.com/fastapi/sqlmodel/pull/1351) by [@tiangolo](https://github.com/tiangolo).
* 📝 Update install and usage with FastAPI CLI in FastAPI tutorial. PR [#1350](https://github.com/fastapi/sqlmodel/pull/1350) by [@tiangolo](https://github.com/tiangolo).
* 📝 Update FastAPI tutorial docs to use the new `model.sqlmodel_update()` instead of old `setattr()`. PR [#1117](https://github.com/fastapi/sqlmodel/pull/1117) by [@jpizquierdo](https://github.com/jpizquierdo).
* ✏️ Update `docs/virtual-environments.md`. PR [#1321](https://github.com/fastapi/sqlmodel/pull/1321) by [@sylvainHellin](https://github.com/sylvainHellin).

### Internal

* ⬆ Bump griffe-typingdoc from 0.2.8 to 0.2.9. PR [#1553](https://github.com/fastapi/sqlmodel/pull/1553) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump mkdocs-material from 9.6.17 to 9.6.20. PR [#1565](https://github.com/fastapi/sqlmodel/pull/1565) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump actions/setup-python from 5 to 6. PR [#1551](https://github.com/fastapi/sqlmodel/pull/1551) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.12.12 to 0.13.0. PR [#1559](https://github.com/fastapi/sqlmodel/pull/1559) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1564](https://github.com/fastapi/sqlmodel/pull/1564) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump actions/labeler from 5 to 6. PR [#1549](https://github.com/fastapi/sqlmodel/pull/1549) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1556](https://github.com/fastapi/sqlmodel/pull/1556) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump typer from 0.17.3 to 0.17.4. PR [#1554](https://github.com/fastapi/sqlmodel/pull/1554) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1546](https://github.com/fastapi/sqlmodel/pull/1546) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump ruff from 0.12.10 to 0.12.12. PR [#1548](https://github.com/fastapi/sqlmodel/pull/1548) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump typer from 0.16.1 to 0.17.3. PR [#1547](https://github.com/fastapi/sqlmodel/pull/1547) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump pypa/gh-action-pypi-publish from 1.12.4 to 1.13.0. PR [#1550](https://github.com/fastapi/sqlmodel/pull/1550) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 👷 Detect and label merge conflicts on PRs automatically. PR [#1552](https://github.com/fastapi/sqlmodel/pull/1552) by [@svlandeg](https://github.com/svlandeg).
* ⬆ Bump ruff from 0.12.9 to 0.12.10. PR [#1532](https://github.com/fastapi/sqlmodel/pull/1532) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1534](https://github.com/fastapi/sqlmodel/pull/1534) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump typer from 0.16.0 to 0.16.1. PR [#1531](https://github.com/fastapi/sqlmodel/pull/1531) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump actions/download-artifact from 4 to 5. PR [#1451](https://github.com/fastapi/sqlmodel/pull/1451) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump actions/checkout from 4 to 5. PR [#1488](https://github.com/fastapi/sqlmodel/pull/1488) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1479](https://github.com/fastapi/sqlmodel/pull/1479) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump mkdocs-macros-plugin from 1.3.7 to 1.3.9. PR [#1507](https://github.com/fastapi/sqlmodel/pull/1507) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.12.7 to 0.12.9. PR [#1521](https://github.com/fastapi/sqlmodel/pull/1521) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump mkdocs-material from 9.6.16 to 9.6.17. PR [#1528](https://github.com/fastapi/sqlmodel/pull/1528) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1444](https://github.com/fastapi/sqlmodel/pull/1444) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump mkdocs-material from 9.6.15 to 9.6.16. PR [#1446](https://github.com/fastapi/sqlmodel/pull/1446) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.12.4 to 0.12.7. PR [#1447](https://github.com/fastapi/sqlmodel/pull/1447) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump tiangolo/latest-changes from 0.3.2 to 0.4.0. PR [#1448](https://github.com/fastapi/sqlmodel/pull/1448) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1437](https://github.com/fastapi/sqlmodel/pull/1437) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump ruff from 0.12.3 to 0.12.4. PR [#1436](https://github.com/fastapi/sqlmodel/pull/1436) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1428](https://github.com/fastapi/sqlmodel/pull/1428) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump ruff from 0.12.2 to 0.12.3. PR [#1432](https://github.com/fastapi/sqlmodel/pull/1432) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1418](https://github.com/fastapi/sqlmodel/pull/1418) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump pillow from 11.2.1 to 11.3.0. PR [#1423](https://github.com/fastapi/sqlmodel/pull/1423) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump mkdocs-material from 9.6.14 to 9.6.15. PR [#1424](https://github.com/fastapi/sqlmodel/pull/1424) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.12.0 to 0.12.2. PR [#1425](https://github.com/fastapi/sqlmodel/pull/1425) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1374](https://github.com/fastapi/sqlmodel/pull/1374) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump ruff from 0.11.13 to 0.12.0. PR [#1403](https://github.com/fastapi/sqlmodel/pull/1403) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ✅ Simplify tests for `tests/test_tutorial/test_code_structure/test_tutorial001.py`, one test file for multiple variants. PR [#1408](https://github.com/fastapi/sqlmodel/pull/1408) by [@tiangolo](https://github.com/tiangolo).
* ✅ Simplify tests setup, one test file for multiple source variants. PR [#1407](https://github.com/fastapi/sqlmodel/pull/1407) by [@tiangolo](https://github.com/tiangolo).
* ✅ Refactor tests to use autouse `clear_sqlmodel`. PR [#1406](https://github.com/fastapi/sqlmodel/pull/1406) by [@tiangolo](https://github.com/tiangolo).
* ⬆ Bump mkdocs-material from 9.5.18 to 9.6.14. PR [#1378](https://github.com/fastapi/sqlmodel/pull/1378) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump typer from 0.15.3 to 0.16.0. PR [#1393](https://github.com/fastapi/sqlmodel/pull/1393) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump cairosvg from 2.7.1 to 2.8.2. PR [#1383](https://github.com/fastapi/sqlmodel/pull/1383) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump ruff from 0.11.7 to 0.11.13. PR [#1397](https://github.com/fastapi/sqlmodel/pull/1397) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 🔧 Remove Google Analytics. PR [#1386](https://github.com/fastapi/sqlmodel/pull/1386) by [@tiangolo](https://github.com/tiangolo).
* ⬆ Bump mkdocs-macros-plugin from 1.0.5 to 1.3.7. PR [#1354](https://github.com/fastapi/sqlmodel/pull/1354) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump griffe-typingdoc from 0.2.5 to 0.2.8. PR [#1359](https://github.com/fastapi/sqlmodel/pull/1359) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Update pre-commit requirement from <4.0.0,>=2.17.0 to >=2.17.0,<5.0.0. PR [#1360](https://github.com/fastapi/sqlmodel/pull/1360) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump pillow from 11.0.0 to 11.2.1. PR [#1361](https://github.com/fastapi/sqlmodel/pull/1361) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1367](https://github.com/fastapi/sqlmodel/pull/1367) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump ruff from 0.9.6 to 0.11.7. PR [#1355](https://github.com/fastapi/sqlmodel/pull/1355) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1353](https://github.com/fastapi/sqlmodel/pull/1353) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump typing-extensions from 4.12.2 to 4.13.2. PR [#1356](https://github.com/fastapi/sqlmodel/pull/1356) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump typer from 0.15.2 to 0.15.3. PR [#1357](https://github.com/fastapi/sqlmodel/pull/1357) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#1339](https://github.com/fastapi/sqlmodel/pull/1339) by [@pre-com
Download .txt
gitextract_v2ezreog/

├── .github/
│   ├── DISCUSSION_TEMPLATE/
│   │   └── questions.yml
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE/
│   │   ├── config.yml
│   │   └── privileged.yml
│   ├── dependabot.yml
│   ├── labeler.yml
│   └── workflows/
│       ├── add-to-project.yml
│       ├── build-docs.yml
│       ├── deploy-docs.yml
│       ├── detect-conflicts.yml
│       ├── issue-manager.yml
│       ├── labeler.yml
│       ├── latest-changes.yml
│       ├── pre-commit.yml
│       ├── publish.yml
│       ├── smokeshow.yml
│       ├── test-redistribute.yml
│       └── test.yml
├── .gitignore
├── .pre-commit-config.yaml
├── .python-version
├── CITATION.cff
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── data/
│   ├── members.yml
│   └── sponsors.yml
├── docs/
│   ├── about/
│   │   └── index.md
│   ├── advanced/
│   │   ├── decimal.md
│   │   ├── index.md
│   │   └── uuid.md
│   ├── alternatives.md
│   ├── contributing.md
│   ├── css/
│   │   ├── custom.css
│   │   └── termynal.css
│   ├── databases.md
│   ├── db-to-code.md
│   ├── environment-variables.md
│   ├── features.md
│   ├── help.md
│   ├── index.md
│   ├── install.md
│   ├── js/
│   │   ├── custom.js
│   │   └── termynal.js
│   ├── learn/
│   │   └── index.md
│   ├── management-tasks.md
│   ├── management.md
│   ├── overrides/
│   │   └── main.html
│   ├── release-notes.md
│   ├── resources/
│   │   └── index.md
│   ├── tutorial/
│   │   ├── automatic-id-none-refresh.md
│   │   ├── code-structure.md
│   │   ├── connect/
│   │   │   ├── create-connected-rows.md
│   │   │   ├── create-connected-tables.md
│   │   │   ├── index.md
│   │   │   ├── read-connected-data.md
│   │   │   ├── remove-data-connections.md
│   │   │   └── update-data-connections.md
│   │   ├── create-db-and-table-with-db-browser.md
│   │   ├── create-db-and-table.md
│   │   ├── delete.md
│   │   ├── fastapi/
│   │   │   ├── delete.md
│   │   │   ├── index.md
│   │   │   ├── limit-and-offset.md
│   │   │   ├── multiple-models.md
│   │   │   ├── read-one.md
│   │   │   ├── relationships.md
│   │   │   ├── response-model.md
│   │   │   ├── session-with-dependency.md
│   │   │   ├── simple-hero-api.md
│   │   │   ├── teams.md
│   │   │   ├── tests.md
│   │   │   ├── update-extra-data.md
│   │   │   └── update.md
│   │   ├── index.md
│   │   ├── indexes.md
│   │   ├── insert.md
│   │   ├── limit-and-offset.md
│   │   ├── many-to-many/
│   │   │   ├── create-data.md
│   │   │   ├── create-models-with-link.md
│   │   │   ├── index.md
│   │   │   ├── link-with-extra-fields.md
│   │   │   └── update-remove-relationships.md
│   │   ├── one.md
│   │   ├── relationship-attributes/
│   │   │   ├── back-populates.md
│   │   │   ├── cascade-delete-relationships.md
│   │   │   ├── create-and-update-relationships.md
│   │   │   ├── define-relationships-attributes.md
│   │   │   ├── index.md
│   │   │   ├── read-relationships.md
│   │   │   ├── remove-relationships.md
│   │   │   └── type-annotation-strings.md
│   │   ├── select.md
│   │   ├── update.md
│   │   └── where.md
│   └── virtual-environments.md
├── docs_src/
│   ├── __init__.py
│   ├── advanced/
│   │   ├── __init__.py
│   │   ├── decimal/
│   │   │   ├── __init__.py
│   │   │   └── tutorial001_py310.py
│   │   └── uuid/
│   │       ├── __init__.py
│   │       ├── tutorial001_py310.py
│   │       └── tutorial002_py310.py
│   └── tutorial/
│       ├── __init__.py
│       ├── automatic_id_none_refresh/
│       │   ├── __init__.py
│       │   ├── annotations/
│       │   │   └── en/
│       │   │       └── tutorial002.md
│       │   ├── tutorial001_py310.py
│       │   └── tutorial002_py310.py
│       ├── code_structure/
│       │   ├── __init__.py
│       │   ├── tutorial001_py310/
│       │   │   ├── __init__.py
│       │   │   ├── app.py
│       │   │   ├── database.py
│       │   │   └── models.py
│       │   └── tutorial002_py310/
│       │       ├── __init__.py
│       │       ├── app.py
│       │       ├── database.py
│       │       ├── hero_model.py
│       │       └── team_model.py
│       ├── connect/
│       │   ├── __init__.py
│       │   ├── create_tables/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── delete/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── insert/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── select/
│       │   │   ├── __init__.py
│       │   │   ├── tutorial001_py310.py
│       │   │   ├── tutorial002_py310.py
│       │   │   ├── tutorial003_py310.py
│       │   │   ├── tutorial004_py310.py
│       │   │   └── tutorial005_py310.py
│       │   └── update/
│       │       ├── __init__.py
│       │       └── tutorial001_py310.py
│       ├── create_db_and_table/
│       │   ├── __init__.py
│       │   ├── annotations/
│       │   │   └── en/
│       │   │       └── tutorial003.md
│       │   ├── tutorial001_py310.py
│       │   ├── tutorial002_py310.py
│       │   └── tutorial003_py310.py
│       ├── delete/
│       │   ├── __init__.py
│       │   ├── annotations/
│       │   │   └── en/
│       │   │       └── tutorial002.md
│       │   ├── tutorial001_py310.py
│       │   └── tutorial002_py310.py
│       ├── fastapi/
│       │   ├── __init__.py
│       │   ├── app_testing/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310/
│       │   │       ├── __init__.py
│       │   │       ├── annotations/
│       │   │       │   └── en/
│       │   │       │       ├── test_main_001.md
│       │   │       │       ├── test_main_002.md
│       │   │       │       ├── test_main_003.md
│       │   │       │       ├── test_main_004.md
│       │   │       │       ├── test_main_005.md
│       │   │       │       └── test_main_006.md
│       │   │       ├── main.py
│       │   │       ├── test_extra_coverage.py
│       │   │       ├── test_main.py
│       │   │       ├── test_main_001.py
│       │   │       ├── test_main_002.py
│       │   │       ├── test_main_003.py
│       │   │       ├── test_main_004.py
│       │   │       ├── test_main_005.py
│       │   │       └── test_main_006.py
│       │   ├── delete/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── limit_and_offset/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── multiple_models/
│       │   │   ├── __init__.py
│       │   │   ├── tutorial001_py310.py
│       │   │   └── tutorial002_py310.py
│       │   ├── read_one/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── relationships/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── response_model/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── session_with_dependency/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── simple_hero_api/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── teams/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   └── update/
│       │       ├── __init__.py
│       │       ├── tutorial001_py310.py
│       │       └── tutorial002_py310.py
│       ├── indexes/
│       │   ├── __init__.py
│       │   ├── tutorial001_py310.py
│       │   └── tutorial002_py310.py
│       ├── insert/
│       │   ├── __init__.py
│       │   ├── annotations/
│       │   │   └── en/
│       │   │       └── tutorial003.md
│       │   ├── tutorial001_py310.py
│       │   ├── tutorial002_py310.py
│       │   └── tutorial003_py310.py
│       ├── many_to_many/
│       │   ├── __init__.py
│       │   ├── tutorial001_py310.py
│       │   ├── tutorial002_py310.py
│       │   └── tutorial003_py310.py
│       ├── offset_and_limit/
│       │   ├── __init__.py
│       │   ├── tutorial001_py310.py
│       │   ├── tutorial002_py310.py
│       │   ├── tutorial003_py310.py
│       │   └── tutorial004_py310.py
│       ├── one/
│       │   ├── __init__.py
│       │   ├── tutorial001_py310.py
│       │   ├── tutorial002_py310.py
│       │   ├── tutorial003_py310.py
│       │   ├── tutorial004_py310.py
│       │   ├── tutorial005_py310.py
│       │   ├── tutorial006_py310.py
│       │   ├── tutorial007_py310.py
│       │   ├── tutorial008_py310.py
│       │   └── tutorial009_py310.py
│       ├── relationship_attributes/
│       │   ├── __init__.py
│       │   ├── back_populates/
│       │   │   ├── __init__.py
│       │   │   ├── tutorial001_py310.py
│       │   │   ├── tutorial002_py310.py
│       │   │   └── tutorial003_py310.py
│       │   ├── cascade_delete_relationships/
│       │   │   ├── __init__.py
│       │   │   ├── tutorial001_py310.py
│       │   │   ├── tutorial002_py310.py
│       │   │   ├── tutorial003_py310.py
│       │   │   ├── tutorial004_py310.py
│       │   │   └── tutorial005_py310.py
│       │   ├── create_and_update_relationships/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   ├── define_relationship_attributes/
│       │   │   ├── __init__.py
│       │   │   └── tutorial001_py310.py
│       │   └── read_relationships/
│       │       ├── __init__.py
│       │       ├── tutorial001_py310.py
│       │       └── tutorial002_py310.py
│       ├── select/
│       │   ├── __init__.py
│       │   ├── annotations/
│       │   │   └── en/
│       │   │       └── tutorial002.md
│       │   ├── tutorial001_py310.py
│       │   ├── tutorial002_py310.py
│       │   ├── tutorial003_py310.py
│       │   └── tutorial004_py310.py
│       ├── update/
│       │   ├── __init__.py
│       │   ├── annotations/
│       │   │   └── en/
│       │   │       ├── tutorial002.md
│       │   │       └── tutorial004.md
│       │   ├── tutorial001_py310.py
│       │   ├── tutorial002_py310.py
│       │   ├── tutorial003_py310.py
│       │   └── tutorial004_py310.py
│       └── where/
│           ├── __init__.py
│           ├── tutorial001_py310.py
│           ├── tutorial002_py310.py
│           ├── tutorial003_py310.py
│           ├── tutorial004_py310.py
│           ├── tutorial005_py310.py
│           ├── tutorial006_py310.py
│           ├── tutorial006b_py310.py
│           ├── tutorial006b_py39.py
│           ├── tutorial007_py310.py
│           ├── tutorial008_py310.py
│           ├── tutorial009_py310.py
│           └── tutorial011_py310.py
├── mkdocs.env.yml
├── mkdocs.yml
├── pyproject.toml
├── scripts/
│   ├── deploy_docs_status.py
│   ├── docs.py
│   ├── format.sh
│   ├── generate_select.py
│   ├── lint.sh
│   ├── mkdocs_hooks.py
│   └── test.sh
├── sqlmodel/
│   ├── __init__.py
│   ├── _compat.py
│   ├── default.py
│   ├── ext/
│   │   ├── __init__.py
│   │   └── asyncio/
│   │       ├── __init__.py
│   │       └── session.py
│   ├── main.py
│   ├── orm/
│   │   ├── __init__.py
│   │   └── session.py
│   ├── pool/
│   │   └── __init__.py
│   ├── py.typed
│   └── sql/
│       ├── __init__.py
│       ├── _expression_select_cls.py
│       ├── _expression_select_gen.py
│       ├── _expression_select_gen.py.jinja2
│       ├── base.py
│       ├── expression.py
│       └── sqltypes.py
├── sqlmodel-slim/
│   └── README.md
└── tests/
    ├── __init__.py
    ├── conftest.py
    ├── test_advanced/
    │   ├── __init__.py
    │   ├── test_decimal/
    │   │   ├── __init__.py
    │   │   └── test_tutorial001.py
    │   └── test_uuid/
    │       ├── __init__.py
    │       ├── test_tutorial001.py
    │       └── test_tutorial002.py
    ├── test_aliases.py
    ├── test_annotated_uuid.py
    ├── test_default.py
    ├── test_deprecations.py
    ├── test_enums.py
    ├── test_enums_models.py
    ├── test_field_sa_args_kwargs.py
    ├── test_field_sa_column.py
    ├── test_field_sa_relationship.py
    ├── test_fields_set.py
    ├── test_future_annotations.py
    ├── test_instance_no_args.py
    ├── test_main.py
    ├── test_missing_type.py
    ├── test_nullable.py
    ├── test_ondelete_raises.py
    ├── test_pydantic/
    │   ├── __init__.py
    │   └── test_field.py
    ├── test_query.py
    ├── test_select_gen.py
    ├── test_select_typing.py
    ├── test_sqlalchemy_type_errors.py
    ├── test_tutorial/
    │   ├── __init__.py
    │   ├── test_automatic_id_none_refresh/
    │   │   ├── __init__.py
    │   │   └── test_tutorial001_tutorial002.py
    │   ├── test_code_structure/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001.py
    │   │   └── test_tutorial002.py
    │   ├── test_connect/
    │   │   ├── __init__.py
    │   │   ├── test_create_connected_tables/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_delete/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_insert/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_select/
    │   │   │   ├── __init__.py
    │   │   │   ├── test_tutorial001_tutorial002.py
    │   │   │   ├── test_tutorial003.py
    │   │   │   ├── test_tutorial004.py
    │   │   │   └── test_tutorial005.py
    │   │   └── test_update/
    │   │       ├── __init__.py
    │   │       └── test_tutorial001.py
    │   ├── test_create_db_and_table/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001.py
    │   │   ├── test_tutorial002.py
    │   │   └── test_tutorial003.py
    │   ├── test_delete/
    │   │   ├── __init__.py
    │   │   └── test_tutorial001_tutorial002.py
    │   ├── test_fastapi/
    │   │   ├── __init__.py
    │   │   ├── test_app_testing/
    │   │   │   ├── __init__.py
    │   │   │   ├── test_tutorial001_tests001.py
    │   │   │   ├── test_tutorial001_tests002.py
    │   │   │   ├── test_tutorial001_tests003.py
    │   │   │   ├── test_tutorial001_tests004.py
    │   │   │   ├── test_tutorial001_tests005.py
    │   │   │   ├── test_tutorial001_tests006.py
    │   │   │   └── test_tutorial001_tests_main.py
    │   │   ├── test_delete/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_limit_and_offset/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_multiple_models/
    │   │   │   ├── __init__.py
    │   │   │   ├── test_tutorial001.py
    │   │   │   └── test_tutorial002.py
    │   │   ├── test_read_one/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_relationships/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_response_model/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_session_with_dependency/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_simple_hero_api/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_teams/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   └── test_update/
    │   │       ├── __init__.py
    │   │       ├── test_tutorial001.py
    │   │       └── test_tutorial002.py
    │   ├── test_indexes/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001.py
    │   │   └── test_tutorial002.py
    │   ├── test_insert/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001.py
    │   │   ├── test_tutorial002.py
    │   │   └── test_tutorial003.py
    │   ├── test_limit_and_offset/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001.py
    │   │   ├── test_tutorial002.py
    │   │   ├── test_tutorial003.py
    │   │   └── test_tutorial004.py
    │   ├── test_many_to_many/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001.py
    │   │   ├── test_tutorial002.py
    │   │   └── test_tutorial003.py
    │   ├── test_one/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001.py
    │   │   ├── test_tutorial002.py
    │   │   ├── test_tutorial003.py
    │   │   ├── test_tutorial004.py
    │   │   ├── test_tutorial005.py
    │   │   ├── test_tutorial006.py
    │   │   ├── test_tutorial007.py
    │   │   ├── test_tutorial008.py
    │   │   └── test_tutorial009.py
    │   ├── test_relationship_attributes/
    │   │   ├── __init__.py
    │   │   ├── test_back_populates/
    │   │   │   ├── __init__.py
    │   │   │   ├── test_tutorial001.py
    │   │   │   ├── test_tutorial002.py
    │   │   │   └── test_tutorial003.py
    │   │   ├── test_create_and_update_relationships/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_define_relationship_attributes/
    │   │   │   ├── __init__.py
    │   │   │   └── test_tutorial001.py
    │   │   ├── test_delete_records_relationship/
    │   │   │   ├── __init__.py
    │   │   │   ├── test_tutorial001.py
    │   │   │   ├── test_tutorial002.py
    │   │   │   ├── test_tutorial003.py
    │   │   │   ├── test_tutorial004.py
    │   │   │   └── test_tutorial005.py
    │   │   └── test_read_relationships/
    │   │       ├── __init__.py
    │   │       ├── test_tutorial001.py
    │   │       └── test_tutorial002.py
    │   ├── test_select/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001_tutorial002.py
    │   │   └── test_tutorial003_tutorial004.py
    │   ├── test_update/
    │   │   ├── __init__.py
    │   │   ├── test_tutorial001_tutorial002.py
    │   │   └── test_tutorial003_tutorial004.py
    │   └── test_where/
    │       ├── __init__.py
    │       ├── test_tutorial001.py
    │       ├── test_tutorial002.py
    │       ├── test_tutorial003.py
    │       ├── test_tutorial004.py
    │       ├── test_tutorial005.py
    │       ├── test_tutorial006.py
    │       ├── test_tutorial006b.py
    │       ├── test_tutorial007.py
    │       ├── test_tutorial008.py
    │       ├── test_tutorial009.py
    │       └── test_tutorial011.py
    ├── test_update.py
    └── test_validation.py
Download .txt
SYMBOL INDEX (1008 symbols across 225 files)

FILE: docs/js/custom.js
  function setupTermynal (line 1) | function setupTermynal() {
  function openLinksInNewTab (line 112) | function openLinksInNewTab() {
  function main (line 139) | async function main() {

FILE: docs/js/termynal.js
  class Termynal (line 14) | class Termynal {
    method constructor (line 30) | constructor(container = '#termynal', options = {}) {
    method loadLines (line 52) | loadLines() {
    method init (line 74) | init() {
    method start (line 96) | async start() {
    method generateRestart (line 129) | generateRestart() {
    method generateFinish (line 142) | generateFinish() {
    method addRestart (line 157) | addRestart() {
    method addFinish (line 162) | addFinish() {
    method type (line 171) | async type(line) {
    method progress (line 187) | async progress(line) {
    method _wait (line 212) | _wait(time) {
    method lineDataToElements (line 223) | lineDataToElements(lineData) {
    method _attributes (line 238) | _attributes(line) {

FILE: docs_src/advanced/decimal/tutorial001_py310.py
  class Hero (line 6) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 20) | def create_db_and_tables():
  function create_heroes (line 24) | def create_heroes():
  function select_heroes (line 37) | def select_heroes():
  function main (line 53) | def main():

FILE: docs_src/advanced/uuid/tutorial001_py310.py
  class Hero (line 6) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 19) | def create_db_and_tables():
  function create_hero (line 23) | def create_hero():
  function select_hero (line 37) | def select_hero():
  function main (line 57) | def main() -> None:

FILE: docs_src/advanced/uuid/tutorial002_py310.py
  class Hero (line 6) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 19) | def create_db_and_tables():
  function create_hero (line 23) | def create_hero():
  function select_hero (line 37) | def select_hero():
  function main (line 56) | def main() -> None:

FILE: docs_src/tutorial/automatic_id_none_refresh/tutorial001_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function main (line 73) | def main():

FILE: docs_src/tutorial/automatic_id_none_refresh/tutorial002_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function main (line 74) | def main():

FILE: docs_src/tutorial/code_structure/tutorial001_py310/app.py
  function create_heroes (line 7) | def create_heroes():
  function main (line 23) | def main():

FILE: docs_src/tutorial/code_structure/tutorial001_py310/database.py
  function create_db_and_tables (line 9) | def create_db_and_tables():

FILE: docs_src/tutorial/code_structure/tutorial001_py310/models.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 12) | class Hero(SQLModel, table=True):

FILE: docs_src/tutorial/code_structure/tutorial002_py310/app.py
  function create_heroes (line 8) | def create_heroes():
  function main (line 24) | def main():

FILE: docs_src/tutorial/code_structure/tutorial002_py310/database.py
  function create_db_and_tables (line 9) | def create_db_and_tables():

FILE: docs_src/tutorial/code_structure/tutorial002_py310/hero_model.py
  class Hero (line 9) | class Hero(SQLModel, table=True):

FILE: docs_src/tutorial/code_structure/tutorial002_py310/team_model.py
  class Team (line 9) | class Team(SQLModel, table=True):

FILE: docs_src/tutorial/connect/create_tables/tutorial001_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 10) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 25) | def create_db_and_tables():
  function main (line 29) | def main():

FILE: docs_src/tutorial/connect/delete/tutorial001_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 10) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 25) | def create_db_and_tables():
  function create_heroes (line 29) | def create_heroes():
  function main (line 73) | def main():

FILE: docs_src/tutorial/connect/insert/tutorial001_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 10) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 25) | def create_db_and_tables():
  function create_heroes (line 29) | def create_heroes():
  function main (line 61) | def main():

FILE: docs_src/tutorial/connect/select/tutorial001_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 10) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 25) | def create_db_and_tables():
  function create_heroes (line 29) | def create_heroes():
  function select_heroes (line 61) | def select_heroes():
  function main (line 69) | def main():

FILE: docs_src/tutorial/connect/select/tutorial002_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 10) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 25) | def create_db_and_tables():
  function create_heroes (line 29) | def create_heroes():
  function select_heroes (line 61) | def select_heroes():
  function main (line 69) | def main():

FILE: docs_src/tutorial/connect/select/tutorial003_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 10) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 25) | def create_db_and_tables():
  function create_heroes (line 29) | def create_heroes():
  function select_heroes (line 61) | def select_heroes():
  function main (line 69) | def main():

FILE: docs_src/tutorial/connect/select/tutorial004_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 10) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 25) | def create_db_and_tables():
  function create_heroes (line 29) | def create_heroes():
  function select_heroes (line 61) | def select_heroes():
  function main (line 69) | def main():

FILE: docs_src/tutorial/connect/select/tutorial005_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 10) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 25) | def create_db_and_tables():
  function create_heroes (line 29) | def create_heroes():
  function select_heroes (line 61) | def select_heroes():
  function main (line 69) | def main():

FILE: docs_src/tutorial/connect/update/tutorial001_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 10) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 25) | def create_db_and_tables():
  function create_heroes (line 29) | def create_heroes():
  function main (line 67) | def main():

FILE: docs_src/tutorial/create_db_and_table/tutorial001_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):

FILE: docs_src/tutorial/create_db_and_table/tutorial002_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():

FILE: docs_src/tutorial/create_db_and_table/tutorial003_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):  # (3)!
  function create_db_and_tables (line 17) | def create_db_and_tables():  # (11)!

FILE: docs_src/tutorial/delete/tutorial001_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function update_heroes (line 42) | def update_heroes():
  function delete_heroes (line 70) | def delete_heroes():
  function main (line 90) | def main():

FILE: docs_src/tutorial/delete/tutorial002_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function update_heroes (line 42) | def update_heroes():
  function delete_heroes (line 70) | def delete_heroes():
  function main (line 91) | def main():

FILE: docs_src/tutorial/fastapi/app_testing/tutorial001_py310/main.py
  class HeroBase (line 5) | class HeroBase(SQLModel):
  class Hero (line 11) | class Hero(HeroBase, table=True):
  class HeroCreate (line 15) | class HeroCreate(HeroBase):
  class HeroPublic (line 19) | class HeroPublic(HeroBase):
  class HeroUpdate (line 23) | class HeroUpdate(SQLModel):
  function create_db_and_tables (line 36) | def create_db_and_tables():
  function get_session (line 40) | def get_session():
  function on_startup (line 49) | def on_startup():
  function create_hero (line 54) | def create_hero(*, session: Session = Depends(get_session), hero: HeroCr...
  function read_heroes (line 63) | def read_heroes(
  function read_hero (line 74) | def read_hero(*, session: Session = Depends(get_session), hero_id: int):
  function update_hero (line 82) | def update_hero(
  function delete_hero (line 97) | def delete_hero(*, session: Session = Depends(get_session), hero_id: int):

FILE: docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_extra_coverage.py
  function test_startup (line 12) | def test_startup():
  function test_get_session (line 19) | def test_get_session():
  function test_read_hero_not_found (line 26) | def test_read_hero_not_found(client: TestClient):
  function test_update_hero_not_found (line 31) | def test_update_hero_not_found(client: TestClient):
  function test_delete_hero_not_found (line 36) | def test_delete_hero_not_found(client: TestClient):

FILE: docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main.py
  function session_fixture (line 10) | def session_fixture():
  function client_fixture (line 20) | def client_fixture(session: Session):
  function test_create_hero (line 30) | def test_create_hero(client: TestClient):
  function test_create_hero_incomplete (line 43) | def test_create_hero_incomplete(client: TestClient):
  function test_create_hero_invalid (line 49) | def test_create_hero_invalid(client: TestClient):
  function test_read_heroes (line 61) | def test_read_heroes(session: Session, client: TestClient):
  function test_read_hero (line 84) | def test_read_hero(session: Session, client: TestClient):
  function test_update_hero (line 99) | def test_update_hero(session: Session, client: TestClient):
  function test_delete_hero (line 114) | def test_delete_hero(session: Session, client: TestClient):

FILE: docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_001.py
  function test_create_hero (line 7) | def test_create_hero():

FILE: docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_002.py
  function test_create_hero (line 7) | def test_create_hero():

FILE: docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_003.py
  function test_create_hero (line 7) | def test_create_hero():

FILE: docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_004.py
  function test_create_hero (line 8) | def test_create_hero():

FILE: docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_005.py
  function session_fixture (line 10) | def session_fixture():  # (3)!
  function test_create_hero (line 19) | def test_create_hero(session: Session):  # (5)!

FILE: docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_006.py
  function session_fixture (line 10) | def session_fixture():
  function client_fixture (line 20) | def client_fixture(session: Session):  # (2)!
  function test_create_hero (line 31) | def test_create_hero(client: TestClient):  # (8)!

FILE: docs_src/tutorial/fastapi/delete/tutorial001_py310.py
  class HeroBase (line 5) | class HeroBase(SQLModel):
  class Hero (line 11) | class Hero(HeroBase, table=True):
  class HeroCreate (line 15) | class HeroCreate(HeroBase):
  class HeroPublic (line 19) | class HeroPublic(HeroBase):
  class HeroUpdate (line 23) | class HeroUpdate(SQLModel):
  function create_db_and_tables (line 36) | def create_db_and_tables():
  function on_startup (line 44) | def on_startup():
  function create_hero (line 49) | def create_hero(hero: HeroCreate):
  function read_heroes (line 59) | def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)):
  function read_hero (line 66) | def read_hero(hero_id: int):
  function update_hero (line 75) | def update_hero(hero_id: int, hero: HeroUpdate):
  function delete_hero (line 89) | def delete_hero(hero_id: int):

FILE: docs_src/tutorial/fastapi/limit_and_offset/tutorial001_py310.py
  class HeroBase (line 5) | class HeroBase(SQLModel):
  class Hero (line 11) | class Hero(HeroBase, table=True):
  class HeroCreate (line 15) | class HeroCreate(HeroBase):
  class HeroPublic (line 19) | class HeroPublic(HeroBase):
  function create_db_and_tables (line 30) | def create_db_and_tables():
  function on_startup (line 38) | def on_startup():
  function create_hero (line 43) | def create_hero(hero: HeroCreate):
  function read_heroes (line 53) | def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)):
  function read_hero (line 60) | def read_hero(hero_id: int):

FILE: docs_src/tutorial/fastapi/multiple_models/tutorial001_py310.py
  class Hero (line 5) | class Hero(SQLModel, table=True):
  class HeroCreate (line 12) | class HeroCreate(SQLModel):
  class HeroPublic (line 18) | class HeroPublic(SQLModel):
  function create_db_and_tables (line 32) | def create_db_and_tables():
  function on_startup (line 40) | def on_startup():
  function create_hero (line 45) | def create_hero(hero: HeroCreate):
  function read_heroes (line 55) | def read_heroes():

FILE: docs_src/tutorial/fastapi/multiple_models/tutorial002_py310.py
  class HeroBase (line 5) | class HeroBase(SQLModel):
  class Hero (line 11) | class Hero(HeroBase, table=True):
  class HeroCreate (line 15) | class HeroCreate(HeroBase):
  class HeroPublic (line 19) | class HeroPublic(HeroBase):
  function create_db_and_tables (line 30) | def create_db_and_tables():
  function on_startup (line 38) | def on_startup():
  function create_hero (line 43) | def create_hero(hero: HeroCreate):
  function read_heroes (line 53) | def read_heroes():

FILE: docs_src/tutorial/fastapi/read_one/tutorial001_py310.py
  class HeroBase (line 5) | class HeroBase(SQLModel):
  class Hero (line 11) | class Hero(HeroBase, table=True):
  class HeroCreate (line 15) | class HeroCreate(HeroBase):
  class HeroPublic (line 19) | class HeroPublic(HeroBase):
  function create_db_and_tables (line 30) | def create_db_and_tables():
  function on_startup (line 38) | def on_startup():
  function create_hero (line 43) | def create_hero(hero: HeroCreate):
  function read_heroes (line 53) | def read_heroes():
  function read_hero (line 60) | def read_hero(hero_id: int):

FILE: docs_src/tutorial/fastapi/relationships/tutorial001_py310.py
  class TeamBase (line 5) | class TeamBase(SQLModel):
  class Team (line 10) | class Team(TeamBase, table=True):
  class TeamCreate (line 16) | class TeamCreate(TeamBase):
  class TeamPublic (line 20) | class TeamPublic(TeamBase):
  class TeamUpdate (line 24) | class TeamUpdate(SQLModel):
  class HeroBase (line 30) | class HeroBase(SQLModel):
  class Hero (line 38) | class Hero(HeroBase, table=True):
  class HeroPublic (line 44) | class HeroPublic(HeroBase):
  class HeroCreate (line 48) | class HeroCreate(HeroBase):
  class HeroUpdate (line 52) | class HeroUpdate(SQLModel):
  class HeroPublicWithTeam (line 59) | class HeroPublicWithTeam(HeroPublic):
  class TeamPublicWithHeroes (line 63) | class TeamPublicWithHeroes(TeamPublic):
  function create_db_and_tables (line 74) | def create_db_and_tables():
  function get_session (line 78) | def get_session():
  function on_startup (line 87) | def on_startup():
  function create_hero (line 92) | def create_hero(*, session: Session = Depends(get_session), hero: HeroCr...
  function read_heroes (line 101) | def read_heroes(
  function read_hero (line 112) | def read_hero(*, session: Session = Depends(get_session), hero_id: int):
  function update_hero (line 120) | def update_hero(
  function delete_hero (line 135) | def delete_hero(*, session: Session = Depends(get_session), hero_id: int):
  function create_team (line 145) | def create_team(*, session: Session = Depends(get_session), team: TeamCr...
  function read_teams (line 154) | def read_teams(
  function read_team (line 165) | def read_team(*, team_id: int, session: Session = Depends(get_session)):
  function update_team (line 173) | def update_team(
  function delete_team (line 191) | def delete_team(*, session: Session = Depends(get_session), team_id: int):

FILE: docs_src/tutorial/fastapi/response_model/tutorial001_py310.py
  class Hero (line 5) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 19) | def create_db_and_tables():
  function on_startup (line 27) | def on_startup():
  function create_hero (line 32) | def create_hero(hero: Hero):
  function read_heroes (line 41) | def read_heroes():

FILE: docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py310.py
  class HeroBase (line 5) | class HeroBase(SQLModel):
  class Hero (line 11) | class Hero(HeroBase, table=True):
  class HeroCreate (line 15) | class HeroCreate(HeroBase):
  class HeroPublic (line 19) | class HeroPublic(HeroBase):
  class HeroUpdate (line 23) | class HeroUpdate(SQLModel):
  function create_db_and_tables (line 36) | def create_db_and_tables():
  function get_session (line 40) | def get_session():
  function on_startup (line 49) | def on_startup():
  function create_hero (line 54) | def create_hero(*, session: Session = Depends(get_session), hero: HeroCr...
  function read_heroes (line 63) | def read_heroes(
  function read_hero (line 74) | def read_hero(*, session: Session = Depends(get_session), hero_id: int):
  function update_hero (line 82) | def update_hero(
  function delete_hero (line 97) | def delete_hero(*, session: Session = Depends(get_session), hero_id: int):

FILE: docs_src/tutorial/fastapi/simple_hero_api/tutorial001_py310.py
  class Hero (line 5) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 19) | def create_db_and_tables():
  function on_startup (line 27) | def on_startup():
  function create_hero (line 32) | def create_hero(hero: Hero):
  function read_heroes (line 41) | def read_heroes():

FILE: docs_src/tutorial/fastapi/teams/tutorial001_py310.py
  class TeamBase (line 5) | class TeamBase(SQLModel):
  class Team (line 10) | class Team(TeamBase, table=True):
  class TeamCreate (line 16) | class TeamCreate(TeamBase):
  class TeamPublic (line 20) | class TeamPublic(TeamBase):
  class TeamUpdate (line 24) | class TeamUpdate(SQLModel):
  class HeroBase (line 29) | class HeroBase(SQLModel):
  class Hero (line 37) | class Hero(HeroBase, table=True):
  class HeroPublic (line 43) | class HeroPublic(HeroBase):
  class HeroCreate (line 47) | class HeroCreate(HeroBase):
  class HeroUpdate (line 51) | class HeroUpdate(SQLModel):
  function create_db_and_tables (line 65) | def create_db_and_tables():
  function get_session (line 69) | def get_session():
  function on_startup (line 78) | def on_startup():
  function create_hero (line 83) | def create_hero(*, session: Session = Depends(get_session), hero: HeroCr...
  function read_heroes (line 92) | def read_heroes(
  function read_hero (line 103) | def read_hero(*, session: Session = Depends(get_session), hero_id: int):
  function update_hero (line 111) | def update_hero(
  function delete_hero (line 126) | def delete_hero(*, session: Session = Depends(get_session), hero_id: int):
  function create_team (line 136) | def create_team(*, session: Session = Depends(get_session), team: TeamCr...
  function read_teams (line 145) | def read_teams(
  function read_team (line 156) | def read_team(*, team_id: int, session: Session = Depends(get_session)):
  function update_team (line 164) | def update_team(
  function delete_team (line 182) | def delete_team(*, session: Session = Depends(get_session), team_id: int):

FILE: docs_src/tutorial/fastapi/update/tutorial001_py310.py
  class HeroBase (line 5) | class HeroBase(SQLModel):
  class Hero (line 11) | class Hero(HeroBase, table=True):
  class HeroCreate (line 15) | class HeroCreate(HeroBase):
  class HeroPublic (line 19) | class HeroPublic(HeroBase):
  class HeroUpdate (line 23) | class HeroUpdate(SQLModel):
  function create_db_and_tables (line 36) | def create_db_and_tables():
  function on_startup (line 44) | def on_startup():
  function create_hero (line 49) | def create_hero(hero: HeroCreate):
  function read_heroes (line 59) | def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)):
  function read_hero (line 66) | def read_hero(hero_id: int):
  function update_hero (line 75) | def update_hero(hero_id: int, hero: HeroUpdate):

FILE: docs_src/tutorial/fastapi/update/tutorial002_py310.py
  class HeroBase (line 5) | class HeroBase(SQLModel):
  class Hero (line 11) | class Hero(HeroBase, table=True):
  class HeroCreate (line 16) | class HeroCreate(HeroBase):
  class HeroPublic (line 20) | class HeroPublic(HeroBase):
  class HeroUpdate (line 24) | class HeroUpdate(SQLModel):
  function create_db_and_tables (line 38) | def create_db_and_tables():
  function hash_password (line 42) | def hash_password(password: str) -> str:
  function on_startup (line 51) | def on_startup():
  function create_hero (line 56) | def create_hero(hero: HeroCreate):
  function read_heroes (line 68) | def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)):
  function read_hero (line 75) | def read_hero(hero_id: int):
  function update_hero (line 84) | def update_hero(hero_id: int, hero: HeroUpdate):

FILE: docs_src/tutorial/indexes/tutorial001_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 34) | def select_heroes():
  function main (line 42) | def main():

FILE: docs_src/tutorial/indexes/tutorial002_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/insert/tutorial001_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function main (line 37) | def main():

FILE: docs_src/tutorial/insert/tutorial002_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function main (line 34) | def main():

FILE: docs_src/tutorial/insert/tutorial003_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():  # (1)!
  function main (line 35) | def main():  # (7)!

FILE: docs_src/tutorial/many_to_many/tutorial001_py310.py
  class HeroTeamLink (line 4) | class HeroTeamLink(SQLModel, table=True):
  class Team (line 9) | class Team(SQLModel, table=True):
  class Hero (line 17) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 32) | def create_db_and_tables():
  function create_heroes (line 36) | def create_heroes():
  function main (line 72) | def main():

FILE: docs_src/tutorial/many_to_many/tutorial002_py310.py
  class HeroTeamLink (line 4) | class HeroTeamLink(SQLModel, table=True):
  class Team (line 9) | class Team(SQLModel, table=True):
  class Hero (line 17) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 32) | def create_db_and_tables():
  function create_heroes (line 36) | def create_heroes():
  function update_heroes (line 72) | def update_heroes():
  function main (line 94) | def main():

FILE: docs_src/tutorial/many_to_many/tutorial003_py310.py
  class HeroTeamLink (line 4) | class HeroTeamLink(SQLModel, table=True):
  class Team (line 13) | class Team(SQLModel, table=True):
  class Hero (line 21) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 36) | def create_db_and_tables():
  function create_heroes (line 40) | def create_heroes():
  function update_heroes (line 82) | def update_heroes():
  function main (line 110) | def main():

FILE: docs_src/tutorial/offset_and_limit/tutorial001_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/offset_and_limit/tutorial002_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/offset_and_limit/tutorial003_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/offset_and_limit/tutorial004_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/one/tutorial001_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/one/tutorial002_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/one/tutorial003_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/one/tutorial004_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/one/tutorial005_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/one/tutorial006_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 48) | def main():

FILE: docs_src/tutorial/one/tutorial007_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/one/tutorial008_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 48) | def main():

FILE: docs_src/tutorial/one/tutorial009_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 48) | def main():

FILE: docs_src/tutorial/relationship_attributes/back_populates/tutorial001_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 12) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 28) | def create_db_and_tables():
  function create_heroes (line 32) | def create_heroes():
  function select_heroes (line 94) | def select_heroes():
  function update_heroes (line 103) | def update_heroes():
  function main (line 133) | def main():

FILE: docs_src/tutorial/relationship_attributes/back_populates/tutorial002_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 12) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 28) | def create_db_and_tables():
  function create_heroes (line 32) | def create_heroes():
  function select_heroes (line 94) | def select_heroes():
  function update_heroes (line 103) | def update_heroes():
  function main (line 133) | def main():

FILE: docs_src/tutorial/relationship_attributes/back_populates/tutorial003_py310.py
  class Weapon (line 4) | class Weapon(SQLModel, table=True):
  class Power (line 11) | class Power(SQLModel, table=True):
  class Team (line 19) | class Team(SQLModel, table=True):
  class Hero (line 27) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 48) | def create_db_and_tables():
  function main (line 52) | def main():

FILE: docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial001_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 12) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 28) | def create_db_and_tables():
  function create_heroes (line 32) | def create_heroes():
  function delete_team (line 76) | def delete_team():
  function select_deleted_heroes (line 85) | def select_deleted_heroes():
  function main (line 98) | def main():

FILE: docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial002_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 12) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 30) | def create_db_and_tables():
  function create_heroes (line 34) | def create_heroes():
  function delete_team (line 78) | def delete_team():
  function select_deleted_heroes (line 87) | def select_deleted_heroes():
  function main (line 100) | def main():

FILE: docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial003_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 12) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 30) | def create_db_and_tables():
  function create_heroes (line 36) | def create_heroes():
  function delete_team (line 80) | def delete_team():
  function select_deleted_heroes (line 89) | def select_deleted_heroes():
  function main (line 102) | def main():

FILE: docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial004_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 12) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 30) | def create_db_and_tables():
  function create_heroes (line 36) | def create_heroes():
  function delete_team (line 80) | def delete_team():
  function select_deleted_heroes (line 89) | def select_deleted_heroes():
  function main (line 102) | def main():

FILE: docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial005_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 12) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 30) | def create_db_and_tables():
  function create_heroes (line 36) | def create_heroes():
  function remove_team_heroes (line 80) | def remove_team_heroes():
  function delete_team (line 91) | def delete_team():
  function select_deleted_heroes (line 100) | def select_deleted_heroes():
  function main (line 113) | def main():

FILE: docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 12) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 28) | def create_db_and_tables():
  function create_heroes (line 32) | def create_heroes():
  function main (line 94) | def main():

FILE: docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 12) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 28) | def create_db_and_tables():
  function create_heroes (line 32) | def create_heroes():
  function main (line 62) | def main():

FILE: docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 12) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 28) | def create_db_and_tables():
  function create_heroes (line 32) | def create_heroes():
  function select_heroes (line 94) | def select_heroes():
  function main (line 108) | def main():

FILE: docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py310.py
  class Team (line 4) | class Team(SQLModel, table=True):
  class Hero (line 12) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 28) | def create_db_and_tables():
  function create_heroes (line 32) | def create_heroes():
  function select_heroes (line 94) | def select_heroes():
  function update_heroes (line 103) | def update_heroes():
  function main (line 117) | def main():

FILE: docs_src/tutorial/select/tutorial001_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 34) | def select_heroes():
  function main (line 42) | def main():

FILE: docs_src/tutorial/select/tutorial002_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):  # (2)!
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 34) | def select_heroes():
  function main (line 43) | def main():

FILE: docs_src/tutorial/select/tutorial003_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 34) | def select_heroes():
  function main (line 42) | def main():

FILE: docs_src/tutorial/select/tutorial004_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 34) | def select_heroes():
  function main (line 40) | def main():

FILE: docs_src/tutorial/update/tutorial001_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function update_heroes (line 42) | def update_heroes():
  function main (line 56) | def main():

FILE: docs_src/tutorial/update/tutorial002_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function update_heroes (line 42) | def update_heroes():
  function main (line 56) | def main():

FILE: docs_src/tutorial/update/tutorial003_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function update_heroes (line 42) | def update_heroes():
  function main (line 70) | def main():

FILE: docs_src/tutorial/update/tutorial004_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function update_heroes (line 42) | def update_heroes():
  function main (line 71) | def main():

FILE: docs_src/tutorial/where/tutorial001_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 34) | def select_heroes():
  function main (line 42) | def main():

FILE: docs_src/tutorial/where/tutorial002_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 34) | def select_heroes():
  function main (line 42) | def main():

FILE: docs_src/tutorial/where/tutorial003_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/where/tutorial004_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/where/tutorial005_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/where/tutorial006_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/where/tutorial006b_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/where/tutorial006b_py39.py
  class Hero (line 6) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 19) | def create_db_and_tables():
  function create_heroes (line 23) | def create_heroes():
  function select_heroes (line 44) | def select_heroes():
  function main (line 52) | def main():

FILE: docs_src/tutorial/where/tutorial007_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/where/tutorial008_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/where/tutorial009_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: docs_src/tutorial/where/tutorial011_py310.py
  class Hero (line 4) | class Hero(SQLModel, table=True):
  function create_db_and_tables (line 17) | def create_db_and_tables():
  function create_heroes (line 21) | def create_heroes():
  function select_heroes (line 42) | def select_heroes():
  function main (line 50) | def main():

FILE: scripts/deploy_docs_status.py
  class Settings (line 12) | class Settings(BaseSettings):
  class LinkData (line 21) | class LinkData(BaseModel):
  function main (line 26) | def main() -> None:

FILE: scripts/docs.py
  function callback (line 24) | def callback() -> None:
  function generate_readme_content (line 41) | def generate_readme_content() -> str:
  function generate_readme (line 72) | def generate_readme() -> None:
  function verify_readme (line 83) | def verify_readme() -> None:
  function live (line 100) | def live(dirty: bool = False) -> None:
  function build (line 118) | def build() -> None:
  function serve (line 128) | def serve() -> None:
  function generate_docs_src_versions_for_file (line 150) | def generate_docs_src_versions_for_file(file_path: Path) -> None:
  function generate_docs_src_versions (line 211) | def generate_docs_src_versions() -> None:
  function copy_py39_to_py310 (line 221) | def copy_py39_to_py310() -> None:
  function update_docs_includes_py39_to_py310 (line 253) | def update_docs_includes_py39_to_py310() -> None:
  function remove_unused_docs_src (line 277) | def remove_unused_docs_src() -> None:

FILE: scripts/generate_select.py
  class Arg (line 18) | class Arg(BaseModel):

FILE: scripts/mkdocs_hooks.py
  function generate_renamed_section_items (line 9) | def generate_renamed_section_items(
  function on_nav (line 34) | def on_nav(

FILE: sqlmodel/_compat.py
  class FakeMetadata (line 45) | class FakeMetadata:
  class ObjectWithUpdateWrapper (line 52) | class ObjectWithUpdateWrapper:
    method __getattribute__ (line 56) | def __getattribute__(self, __name: str) -> Any:
  function _is_union_type (line 64) | def _is_union_type(t: Any) -> bool:
  function partial_init (line 72) | def partial_init() -> Generator[None, None, None]:
  class SQLModelConfig (line 78) | class SQLModelConfig(BaseConfig, total=False):
  function get_model_fields (line 83) | def get_model_fields(model: InstanceOrType[BaseModel]) -> dict[str, "Fie...
  function init_pydantic_private_attrs (line 94) | def init_pydantic_private_attrs(new_object: InstanceOrType["SQLModel"]) ...
  function get_annotations (line 100) | def get_annotations(class_dict: dict[str, Any]) -> dict[str, Any]:
  function is_table_model_class (line 115) | def is_table_model_class(cls: type[Any]) -> bool:
  function get_relationship_to (line 122) | def get_relationship_to(
  function is_field_noneable (line 157) | def is_field_noneable(field: "FieldInfo") -> bool:
  function get_sa_type_from_type_annotation (line 174) | def get_sa_type_from_type_annotation(annotation: Any) -> Any:
  function get_sa_type_from_field (line 196) | def get_sa_type_from_field(field: Any) -> Any:
  function get_field_metadata (line 201) | def get_field_metadata(field: Any) -> Any:
  function sqlmodel_table_construct (line 208) | def sqlmodel_table_construct(
  function sqlmodel_validate (line 276) | def sqlmodel_validate(
  function sqlmodel_init (line 329) | def sqlmodel_init(*, self: "SQLModel", data: dict[str, Any]) -> None:

FILE: sqlmodel/default.py
  class _DefaultPlaceholder (line 4) | class _DefaultPlaceholder:
    method __init__ (line 12) | def __init__(self, value: Any):
    method __bool__ (line 15) | def __bool__(self) -> bool:
    method __eq__ (line 18) | def __eq__(self, o: object) -> bool:
  function Default (line 25) | def Default(value: _TDefaultType) -> _TDefaultType:

FILE: sqlmodel/ext/asyncio/session.py
  class AsyncSession (line 29) | class AsyncSession(_AsyncSession):
    method exec (line 34) | async def exec(
    method exec (line 46) | async def exec(
    method exec (line 58) | async def exec(
    method exec (line 69) | async def exec(
    method execute (line 125) | async def execute(

FILE: sqlmodel/main.py
  function __dataclass_transform__ (line 94) | def __dataclass_transform__(
  class FieldInfo (line 104) | class FieldInfo(PydanticFieldInfo):  # type: ignore[misc]
    method __init__ (line 106) | def __init__(self, default: Any = Undefined, **kwargs: Any) -> None:
  class RelationshipInfo (line 172) | class RelationshipInfo(Representation):
    method __init__ (line 173) | def __init__(
  class FieldInfoMetadata (line 205) | class FieldInfoMetadata:
  function _get_sqlmodel_field_metadata (line 218) | def _get_sqlmodel_field_metadata(field_info: Any) -> FieldInfoMetadata |...
  function _get_sqlmodel_field_value (line 227) | def _get_sqlmodel_field_value(
  function Field (line 238) | def Field(
  function Field (line 281) | def Field(
  function Field (line 333) | def Field(
  function Field (line 366) | def Field(
  function Relationship (line 477) | def Relationship(
  function Relationship (line 489) | def Relationship(
  function Relationship (line 499) | def Relationship(
  class SQLModelMetaclass (line 522) | class SQLModelMetaclass(ModelMetaclass, DeclarativeMeta):
    method __setattr__ (line 528) | def __setattr__(cls, name: str, value: Any) -> None:
    method __delattr__ (line 534) | def __delattr__(cls, name: str) -> None:
    method __new__ (line 541) | def __new__(
    method __init__ (line 628) | def __init__(
  function get_sqlalchemy_type (line 687) | def get_sqlalchemy_type(field: Any) -> Any:
  function get_column_from_field (line 741) | def get_column_from_field(field: Any) -> Column:  # type: ignore
  class SQLModel (line 807) | class SQLModel(BaseModel, metaclass=SQLModelMetaclass, registry=default_...
    method __new__ (line 817) | def __new__(cls, *args: Any, **kwargs: Any) -> Any:
    method __init__ (line 827) | def __init__(__pydantic_self__, **data: Any) -> None:
    method __setattr__ (line 847) | def __setattr__(self, name: str, value: Any) -> None:
    method __repr_args__ (line 860) | def __repr_args__(self) -> Sequence[tuple[str | None, Any]]:
    method __tablename__ (line 869) | def __tablename__(cls) -> str:
    method model_validate (line 873) | def model_validate(  # type: ignore[override]
    method model_dump (line 891) | def model_dump(
    method dict (line 936) | def dict(
    method from_orm (line 962) | def from_orm(
    method parse_obj (line 976) | def parse_obj(
    method sqlmodel_update (line 983) | def sqlmodel_update(

FILE: sqlmodel/orm/session.py
  class Session (line 25) | class Session(_Session):
    method exec (line 27) | def exec(
    method exec (line 39) | def exec(
    method exec (line 51) | def exec(
    method exec (line 62) | def exec(
    method execute (line 108) | def execute(
    method query (line 156) | def query(  # type: ignore

FILE: sqlmodel/sql/_expression_select_cls.py
  class SelectBase (line 16) | class SelectBase(_Select[tuple[_T]]):
    method where (line 19) | def where(self, *whereclause: _ColumnExpressionArgument[bool] | bool) ...
    method having (line 25) | def having(self, *having: _ColumnExpressionArgument[bool] | bool) -> S...
  class Select (line 32) | class Select(SelectBase[_T]):
  class SelectOfScalar (line 40) | class SelectOfScalar(SelectBase[_T]):

FILE: sqlmodel/sql/_expression_select_gen.py
  function select (line 106) | def select(__ent0: _TCCA[_T0]) -> SelectOfScalar[_T0]: ...
  function select (line 110) | def select(__ent0: _TScalar_0) -> SelectOfScalar[_TScalar_0]:  # type: i...
  function select (line 118) | def select(  # type: ignore
  function select (line 125) | def select(  # type: ignore
  function select (line 132) | def select(  # type: ignore
  function select (line 139) | def select(  # type: ignore
  function select (line 146) | def select(  # type: ignore
  function select (line 154) | def select(  # type: ignore
  function select (line 162) | def select(  # type: ignore
  function select (line 170) | def select(  # type: ignore
  function select (line 178) | def select(  # type: ignore
  function select (line 186) | def select(  # type: ignore
  function select (line 194) | def select(  # type: ignore
  function select (line 202) | def select(  # type: ignore
  function select (line 210) | def select(  # type: ignore
  function select (line 219) | def select(  # type: ignore
  function select (line 228) | def select(  # type: ignore
  function select (line 237) | def select(  # type: ignore
  function select (line 246) | def select(  # type: ignore
  function select (line 255) | def select(  # type: ignore
  function select (line 264) | def select(  # type: ignore
  function select (line 273) | def select(  # type: ignore
  function select (line 282) | def select(  # type: ignore
  function select (line 291) | def select(  # type: ignore
  function select (line 300) | def select(  # type: ignore
  function select (line 309) | def select(  # type: ignore
  function select (line 318) | def select(  # type: ignore
  function select (line 327) | def select(  # type: ignore
  function select (line 336) | def select(  # type: ignore
  function select (line 345) | def select(  # type: ignore
  function select (line 356) | def select(*entities: Any) -> Select | SelectOfScalar:  # type: ignore

FILE: sqlmodel/sql/base.py
  class Executable (line 8) | class Executable(_Executable, Generic[_T]):

FILE: sqlmodel/sql/expression.py
  function all_ (line 50) | def all_(expr: _ColumnExpressionArgument[_T] | _T) -> CollectionAggregat...
  function and_ (line 54) | def and_(
  function any_ (line 61) | def any_(expr: _ColumnExpressionArgument[_T] | _T) -> CollectionAggregat...
  function asc (line 65) | def asc(
  function collate (line 71) | def collate(
  function between (line 77) | def between(
  function not_ (line 86) | def not_(clause: _ColumnExpressionArgument[_T] | _T) -> ColumnElement[_T]:
  function case (line 90) | def case(
  function cast (line 98) | def cast(
  function try_cast (line 105) | def try_cast(
  function desc (line 112) | def desc(
  function distinct (line 118) | def distinct(expr: _ColumnExpressionArgument[_T] | _T) -> UnaryExpressio...
  function bitwise_not (line 122) | def bitwise_not(expr: _ColumnExpressionArgument[_T] | _T) -> UnaryExpres...
  function extract (line 126) | def extract(field: str, expr: _ColumnExpressionArgument[Any] | Any) -> E...
  function funcfilter (line 130) | def funcfilter(
  function label (line 136) | def label(
  function nulls_first (line 144) | def nulls_first(
  function nulls_last (line 150) | def nulls_last(column: _ColumnExpressionArgument[_T] | _T) -> UnaryExpre...
  function or_ (line 154) | def or_(
  function over (line 161) | def over(
  function tuple_ (line 179) | def tuple_(
  function type_coerce (line 186) | def type_coerce(
  function within_group (line 193) | def within_group(
  function col (line 199) | def col(column_expression: _T) -> Mapped[_T]:

FILE: sqlmodel/sql/sqltypes.py
  class AutoString (line 7) | class AutoString(types.TypeDecorator):  # type: ignore
    method load_dialect_impl (line 12) | def load_dialect_impl(self, dialect: Dialect) -> "types.TypeEngine[Any]":

FILE: tests/conftest.py
  function clear_sqlmodel (line 20) | def clear_sqlmodel() -> Any:
  function cov_tmp_path (line 31) | def cov_tmp_path(tmp_path: Path) -> Generator[Path, None, None]:
  function coverage_run (line 38) | def coverage_run(*, module: str, cwd: str | Path) -> subprocess.Complete...
  function get_testing_print_function (line 55) | def get_testing_print_function(
  class PrintMock (line 77) | class PrintMock:
  function print_mock_fixture (line 82) | def print_mock_fixture() -> Generator[PrintMock, None, None]:

FILE: tests/test_advanced/test_decimal/test_tutorial001.py
  function get_module (line 17) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 49) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_advanced/test_uuid/test_tutorial001.py
  function get_module (line 17) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 24) | def test_tutorial(print_mock: PrintMock, mod: ModuleType) -> None:

FILE: tests/test_advanced/test_uuid/test_tutorial002.py
  function get_module (line 17) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 24) | def test_tutorial(print_mock: PrintMock, mod: ModuleType) -> None:

FILE: tests/test_aliases.py
  class PydanticUser (line 11) | class PydanticUser(BaseModel):
  class SQLModelUser (line 15) | class SQLModelUser(SQLModel):
  class PydanticUserWithConfig (line 20) | class PydanticUserWithConfig(PydanticUser):
  class SQLModelUserWithConfig (line 24) | class SQLModelUserWithConfig(SQLModelUser):
  function test_create_with_field_name (line 29) | def test_create_with_field_name(model: type[PydanticUser] | type[SQLMode...
  function test_create_with_field_name_with_config (line 35) | def test_create_with_field_name_with_config(
  function test_create_with_alias (line 46) | def test_create_with_alias(
  function test_create_with_both_prefers_alias (line 57) | def test_create_with_both_prefers_alias(
  function test_dict_default_uses_field_names (line 65) | def test_dict_default_uses_field_names(
  function test_dict_by_alias_uses_aliases (line 76) | def test_dict_by_alias_uses_aliases(
  function test_json_by_alias (line 87) | def test_json_by_alias(
  class PydanticUserV2 (line 96) | class PydanticUserV2(BaseModel):
  class SQLModelUserV2 (line 100) | class SQLModelUserV2(SQLModel):
  function test_create_with_validation_alias (line 105) | def test_create_with_validation_alias(
  function test_serialize_with_serialization_alias (line 113) | def test_serialize_with_serialization_alias(
  function test_schema_extra_validation_alias_sqlmodel_v2 (line 124) | def test_schema_extra_validation_alias_sqlmodel_v2():
  function test_schema_extra_serialization_alias_sqlmodel_v2 (line 132) | def test_schema_extra_serialization_alias_sqlmodel_v2():
  function test_alias_plus_validation_alias_prefers_validation_alias_sqlmodel_v2 (line 143) | def test_alias_plus_validation_alias_prefers_validation_alias_sqlmodel_v...
  function test_alias_plus_serialization_alias_prefers_serialization_alias_sqlmodel_v2 (line 151) | def test_alias_plus_serialization_alias_prefers_serialization_alias_sqlm...
  function test_alias_generator_works_sqlmodel_v2 (line 162) | def test_alias_generator_works_sqlmodel_v2():
  function test_alias_generator_with_explicit_alias_prefers_field_alias_sqlmodel_v2 (line 173) | def test_alias_generator_with_explicit_alias_prefers_field_alias_sqlmode...

FILE: tests/test_annotated_uuid.py
  function test_annotated_optional_types (line 6) | def test_annotated_optional_types(clear_sqlmodel) -> None:

FILE: tests/test_default.py
  function test_default_bool (line 4) | def test_default_bool() -> None:
  function test_equality (line 26) | def test_equality() -> None:
  function test_not_equality (line 33) | def test_not_equality() -> None:
  function test_not_equality_other (line 40) | def test_not_equality_other() -> None:

FILE: tests/test_deprecations.py
  class Item (line 5) | class Item(SQLModel):
  class SubItem (line 9) | class SubItem(Item):
  function test_deprecated_from_orm_inheritance (line 13) | def test_deprecated_from_orm_inheritance():
  function test_deprecated_parse_obj (line 21) | def test_deprecated_parse_obj():
  function test_deprecated_dict (line 27) | def test_deprecated_dict():

FILE: tests/test_enums.py
  function pg_dump (line 19) | def pg_dump(sql: TypeEngine, *args, **kwargs):
  function sqlite_dump (line 26) | def sqlite_dump(sql: TypeEngine, *args, **kwargs):
  function test_postgres_ddl_sql (line 37) | def test_postgres_ddl_sql(clear_sqlmodel, capsys: pytest.CaptureFixture[...
  function test_sqlite_ddl_sql (line 47) | def test_sqlite_ddl_sql(clear_sqlmodel, capsys: pytest.CaptureFixture[st...
  function test_json_schema_flat_model_pydantic_v2 (line 57) | def test_json_schema_flat_model_pydantic_v2():
  function test_json_schema_inherit_model_pydantic_v2 (line 72) | def test_json_schema_inherit_model_pydantic_v2():

FILE: tests/test_enums_models.py
  class MyEnum1 (line 7) | class MyEnum1(str, enum.Enum):
  class MyEnum2 (line 12) | class MyEnum2(str, enum.Enum):
  class BaseModel (line 17) | class BaseModel(SQLModel):
  class FlatModel (line 22) | class FlatModel(SQLModel, table=True):
  class InheritModel (line 27) | class InheritModel(BaseModel, table=True):

FILE: tests/test_field_sa_args_kwargs.py
  function test_sa_column_args (line 5) | def test_sa_column_args(clear_sqlmodel, caplog) -> None:
  function test_sa_column_kargs (line 25) | def test_sa_column_kargs(clear_sqlmodel, caplog) -> None:

FILE: tests/test_field_sa_column.py
  function test_sa_column_takes_precedence (line 8) | def test_sa_column_takes_precedence() -> None:
  function test_sa_column_with_annotated_metadata (line 20) | def test_sa_column_with_annotated_metadata() -> None:
  function test_sa_column_no_sa_args (line 31) | def test_sa_column_no_sa_args() -> None:
  function test_sa_column_no_sa_kargs (line 42) | def test_sa_column_no_sa_kargs() -> None:
  function test_sa_column_no_type (line 53) | def test_sa_column_no_type() -> None:
  function test_sa_column_no_primary_key (line 64) | def test_sa_column_no_primary_key() -> None:
  function test_sa_column_no_nullable (line 75) | def test_sa_column_no_nullable() -> None:
  function test_sa_column_no_foreign_key (line 86) | def test_sa_column_no_foreign_key() -> None:
  function test_sa_column_no_unique (line 102) | def test_sa_column_no_unique() -> None:
  function test_sa_column_no_index (line 113) | def test_sa_column_no_index() -> None:
  function test_sa_column_no_ondelete (line 124) | def test_sa_column_no_ondelete() -> None:

FILE: tests/test_field_sa_relationship.py
  function test_sa_relationship_no_args (line 6) | def test_sa_relationship_no_args() -> None:
  function test_sa_relationship_no_kwargs (line 30) | def test_sa_relationship_no_kwargs() -> None:

FILE: tests/test_fields_set.py
  function test_fields_set (line 6) | def test_fields_set():

FILE: tests/test_future_annotations.py
  function test_model_with_future_annotations (line 8) | def test_model_with_future_annotations(clear_sqlmodel):
  function test_model_with_string_annotations (line 36) | def test_model_with_string_annotations(clear_sqlmodel):

FILE: tests/test_instance_no_args.py
  function test_allow_instantiation_without_arguments (line 6) | def test_allow_instantiation_without_arguments(clear_sqlmodel):
  function test_not_allow_instantiation_without_arguments_if_not_table (line 26) | def test_not_allow_instantiation_without_arguments_if_not_table():

FILE: tests/test_main.py
  function test_should_allow_duplicate_row_if_unique_constraint_is_not_passed (line 9) | def test_should_allow_duplicate_row_if_unique_constraint_is_not_passed(c...
  function test_should_allow_duplicate_row_if_unique_constraint_is_false (line 39) | def test_should_allow_duplicate_row_if_unique_constraint_is_false(clear_...
  function test_should_raise_exception_when_try_to_duplicate_row_if_unique_constraint_is_true (line 69) | def test_should_raise_exception_when_try_to_duplicate_row_if_unique_cons...
  function test_sa_relationship_property (line 96) | def test_sa_relationship_property(clear_sqlmodel):
  function test_composite_primary_key (line 130) | def test_composite_primary_key(clear_sqlmodel):
  function test_composite_primary_key_and_validator (line 156) | def test_composite_primary_key_and_validator(clear_sqlmodel):
  function test_foreign_key_ondelete_with_annotated (line 191) | def test_foreign_key_ondelete_with_annotated(clear_sqlmodel):

FILE: tests/test_missing_type.py
  function test_missing_sql_type (line 6) | def test_missing_sql_type():

FILE: tests/test_nullable.py
  function test_nullable_fields (line 6) | def test_nullable_fields(clear_sqlmodel, caplog):
  function test_non_nullable_optional_field_with_no_default_set (line 81) | def test_non_nullable_optional_field_with_no_default_set(clear_sqlmodel,...
  function test_nullable_primary_key (line 108) | def test_nullable_primary_key(clear_sqlmodel, caplog):

FILE: tests/test_ondelete_raises.py
  function test_ondelete_requires_nullable (line 7) | def test_ondelete_requires_nullable(clear_sqlmodel: Any) -> None:
  function test_ondelete_requires_foreign_key (line 29) | def test_ondelete_requires_foreign_key(clear_sqlmodel: Any) -> None:

FILE: tests/test_pydantic/test_field.py
  function test_decimal (line 9) | def test_decimal():
  function test_discriminator (line 24) | def test_discriminator():
  function test_repr (line 50) | def test_repr():

FILE: tests/test_query.py
  function test_query (line 5) | def test_query(clear_sqlmodel):

FILE: tests/test_select_gen.py
  function test_select_gen (line 9) | def test_select_gen() -> None:

FILE: tests/test_select_typing.py
  function test_fields (line 5) | def test_fields() -> None:

FILE: tests/test_sqlalchemy_type_errors.py
  function test_type_list_breaks (line 7) | def test_type_list_breaks() -> None:
  function test_type_dict_breaks (line 15) | def test_type_dict_breaks() -> None:
  function test_type_union_breaks (line 23) | def test_type_union_breaks() -> None:

FILE: tests/test_tutorial/test_automatic_id_none_refresh/test_tutorial001_tutorial002.py
  function check_calls (line 11) | def check_calls(calls: list[list[str | dict[str, Any]]]) -> None:
  function get_module (line 145) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial_001_tutorial_002 (line 155) | def test_tutorial_001_tutorial_002(print_mock: PrintMock, module: Module...

FILE: tests/test_tutorial/test_code_structure/test_tutorial001.py
  class Modules (line 29) | class Modules:
  function get_modules (line 40) | def get_modules(request: pytest.FixtureRequest) -> Modules:
  function test_tutorial (line 54) | def test_tutorial(print_mock: PrintMock, modules: Modules):

FILE: tests/test_tutorial/test_code_structure/test_tutorial002.py
  class Modules (line 29) | class Modules:
  function get_modules (line 40) | def get_modules(request: pytest.FixtureRequest) -> Modules:
  function test_tutorial (line 54) | def test_tutorial(print_mock: PrintMock, modules: Modules):

FILE: tests/test_tutorial/test_connect/test_create_connected_tables/test_tutorial001.py
  function get_module (line 18) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial001 (line 25) | def test_tutorial001(module: ModuleType):

FILE: tests/test_tutorial/test_connect/test_delete/test_tutorial001.py
  function get_module (line 69) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 78) | def test_tutorial(print_mock: PrintMock, module: ModuleType):

FILE: tests/test_tutorial/test_connect/test_insert/test_tutorial001.py
  function get_module (line 49) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial001 (line 58) | def test_tutorial001(print_mock: PrintMock, module: ModuleType):

FILE: tests/test_tutorial/test_connect/test_select/test_tutorial001_tutorial002.py
  function get_module (line 68) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial001 (line 84) | def test_tutorial001(print_mock: PrintMock, module: ModuleType):
  function test_tutorial002 (line 96) | def test_tutorial002(print_mock: PrintMock, module: ModuleType):

FILE: tests/test_tutorial/test_connect/test_select/test_tutorial003.py
  function get_module (line 85) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 94) | def test_tutorial(print_mock: PrintMock, module: ModuleType):

FILE: tests/test_tutorial/test_connect/test_select/test_tutorial004.py
  function get_module (line 59) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 68) | def test_tutorial(print_mock: PrintMock, module: ModuleType):

FILE: tests/test_tutorial/test_connect/test_select/test_tutorial005.py
  function get_module (line 61) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 70) | def test_tutorial(print_mock: PrintMock, module: ModuleType):

FILE: tests/test_tutorial/test_connect/test_update/test_tutorial001.py
  function get_module (line 59) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 68) | def test_tutorial(print_mock: PrintMock, module: ModuleType):

FILE: tests/test_tutorial/test_create_db_and_table/test_tutorial001.py
  function test_create_db_and_table (line 14) | def test_create_db_and_table(cov_tmp_path: Path, module_name: str):

FILE: tests/test_tutorial/test_create_db_and_table/test_tutorial002.py
  function get_module (line 18) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_create_db_and_table (line 27) | def test_create_db_and_table(module: ModuleType):

FILE: tests/test_tutorial/test_create_db_and_table/test_tutorial003.py
  function get_module (line 18) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_create_db_and_table (line 27) | def test_create_db_and_table(module: ModuleType):

FILE: tests/test_tutorial/test_delete/test_tutorial001_tutorial002.py
  function get_module (line 64) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial001 (line 78) | def test_tutorial001(print_mock: PrintMock, module: ModuleType):
  function test_tutorial002 (line 90) | def test_tutorial002(print_mock: PrintMock, module: ModuleType):

FILE: tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests001.py
  class Modules (line 12) | class Modules:
  function get_modules_path (line 23) | def get_modules_path(request: pytest.FixtureRequest) -> str:
  function load_modules (line 28) | def load_modules(clear_sqlmodel, modules_path: str) -> Modules:
  function test_tutorial (line 41) | def test_tutorial(modules: Modules):

FILE: tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests002.py
  class Modules (line 12) | class Modules:
  function get_modules_path (line 23) | def get_modules_path(request: pytest.FixtureRequest) -> str:
  function load_modules (line 28) | def load_modules(clear_sqlmodel, modules_path: str) -> Modules:
  function test_tutorial (line 41) | def test_tutorial(modules: Modules):

FILE: tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests003.py
  class Modules (line 12) | class Modules:
  function get_modules_path (line 23) | def get_modules_path(request: pytest.FixtureRequest) -> str:
  function load_modules (line 28) | def load_modules(clear_sqlmodel, modules_path: str) -> Modules:
  function test_tutorial (line 41) | def test_tutorial(modules: Modules):

FILE: tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests004.py
  class Modules (line 12) | class Modules:
  function get_modules_path (line 23) | def get_modules_path(request: pytest.FixtureRequest) -> str:
  function load_modules (line 28) | def load_modules(clear_sqlmodel, modules_path: str) -> Modules:
  function test_tutorial (line 41) | def test_tutorial(modules: Modules):

FILE: tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests005.py
  function prepare_fixture (line 18) | def prepare_fixture(clear_sqlmodel):
  function test_tutorial (line 25) | def test_tutorial(prepare, session: Session):

FILE: tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests006.py
  function prepare_fixture (line 21) | def prepare_fixture(clear_sqlmodel):
  function test_tutorial (line 28) | def test_tutorial(prepare, session: Session, client: TestClient):

FILE: tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py
  function get_module (line 17) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_run_tests (line 24) | def test_run_tests(module: ModuleType):

FILE: tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py
  function get_module (line 19) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 28) | def test_tutorial(module: ModuleType):

FILE: tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py
  function get_module (line 19) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 30) | def test_tutorial(module: ModuleType):

FILE: tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py
  function get_module (line 21) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 32) | def test_tutorial(module: ModuleType):

FILE: tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py
  function get_module (line 21) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 32) | def test_tutorial(module: ModuleType):

FILE: tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py
  function get_module (line 19) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 28) | def test_tutorial(module: ModuleType):

FILE: tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py
  function get_module (line 19) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 30) | def test_tutorial(module: ModuleType):

FILE: tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py
  function get_module (line 19) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 30) | def test_tutorial(module: ModuleType):

FILE: tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py
  function get_module (line 19) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 30) | def test_tutorial(module: ModuleType):

FILE: tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py
  function get_module (line 19) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 30) | def test_tutorial(module: ModuleType):

FILE: tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py
  function get_module (line 19) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 28) | def test_tutorial(module: ModuleType):

FILE: tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py
  function get_module (line 19) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 28) | def test_tutorial(module: ModuleType):

FILE: tests/test_tutorial/test_fastapi/test_update/test_tutorial002.py
  function get_module (line 19) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 28) | def test_tutorial(module: ModuleType):

FILE: tests/test_tutorial/test_indexes/test_tutorial001.py
  function get_module (line 18) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 25) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_indexes/test_tutorial002.py
  function get_module (line 18) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 25) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_insert/test_tutorial001.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(mod: ModuleType):

FILE: tests/test_tutorial/test_insert/test_tutorial002.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(mod: ModuleType):

FILE: tests/test_tutorial/test_insert/test_tutorial003.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(mod: ModuleType):

FILE: tests/test_tutorial/test_limit_and_offset/test_tutorial001.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 39) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_limit_and_offset/test_tutorial002.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 39) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_limit_and_offset/test_tutorial003.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 37) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_limit_and_offset/test_tutorial004.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_many_to_many/test_tutorial001.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 54) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_many_to_many/test_tutorial002.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 81) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_many_to_many/test_tutorial003.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 77) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_one/test_tutorial001.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_one/test_tutorial002.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_one/test_tutorial003.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_one/test_tutorial004.py
  function get_module (line 17) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 24) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_one/test_tutorial005.py
  function get_module (line 17) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 24) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_one/test_tutorial006.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_one/test_tutorial007.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_one/test_tutorial008.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_one/test_tutorial009.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial001.py
  function get_module (line 17) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 292) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial002.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 284) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial003.py
  function get_module (line 18) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 27) | def test_tutorial(mod: ModuleType):

FILE: tests/test_tutorial/test_relationship_attributes/test_create_and_update_relationships/test_tutorial001.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 103) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_relationship_attributes/test_define_relationship_attributes/test_tutorial001.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 59) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial001.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 25) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial002.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 25) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial003.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 25) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial004.py
  function get_module (line 17) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 26) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial005.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 25) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_relationship_attributes/test_read_relationships/test_tutorial001.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 111) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_relationship_attributes/test_read_relationships/test_tutorial002.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 153) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_select/test_tutorial001_tutorial002.py
  function check_calls (line 11) | def check_calls(calls: list[list[str | dict[str, Any]]]):
  function get_module (line 33) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial_001 (line 47) | def test_tutorial_001(print_mock: PrintMock, module: ModuleType):
  function test_tutorial_002 (line 59) | def test_tutorial_002(print_mock: PrintMock, module: ModuleType):

FILE: tests/test_tutorial/test_select/test_tutorial003_tutorial004.py
  function check_calls (line 11) | def check_calls(calls: list[list[str | dict[str, Any]]]):
  function get_module (line 35) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial_003 (line 49) | def test_tutorial_003(print_mock: PrintMock, module: ModuleType):
  function test_tutorial_004 (line 61) | def test_tutorial_004(print_mock: PrintMock, module: ModuleType):

FILE: tests/test_tutorial/test_update/test_tutorial001_tutorial002.py
  function get_module (line 32) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial001 (line 46) | def test_tutorial001(print_mock: PrintMock, module: ModuleType):
  function test_tutorial002 (line 58) | def test_tutorial002(print_mock: PrintMock, module: ModuleType):

FILE: tests/test_tutorial/test_update/test_tutorial003_tutorial004.py
  function get_module (line 45) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial003 (line 59) | def test_tutorial003(print_mock: PrintMock, module: ModuleType):
  function test_tutorial004 (line 71) | def test_tutorial004(print_mock: PrintMock, module: ModuleType):

FILE: tests/test_tutorial/test_where/test_tutorial001.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_where/test_tutorial002.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_where/test_tutorial003.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_where/test_tutorial004.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_where/test_tutorial005.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_where/test_tutorial006.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_where/test_tutorial006b.py
  function get_module (line 17) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 24) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_where/test_tutorial007.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_where/test_tutorial008.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_where/test_tutorial009.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_tutorial/test_where/test_tutorial011.py
  function get_module (line 16) | def get_module(request: pytest.FixtureRequest) -> ModuleType:
  function test_tutorial (line 23) | def test_tutorial(print_mock: PrintMock, mod: ModuleType):

FILE: tests/test_update.py
  function test_sqlmodel_update (line 4) | def test_sqlmodel_update():

FILE: tests/test_validation.py
  function test_validation_pydantic_v2 (line 6) | def test_validation_pydantic_v2(clear_sqlmodel):
Condensed preview — 434 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,400K chars).
[
  {
    "path": ".github/DISCUSSION_TEMPLATE/questions.yml",
    "chars": 5929,
    "preview": "labels: [question]\nbody:\n  - type: markdown\n    attributes:\n      value: |\n        Thanks for your interest in SQLModel!"
  },
  {
    "path": ".github/FUNDING.yml",
    "chars": 19,
    "preview": "github: [tiangolo]\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "chars": 770,
    "preview": "blank_issues_enabled: false\ncontact_links:\n  - name: Security Contact\n    about: Please report security vulnerabilities "
  },
  {
    "path": ".github/ISSUE_TEMPLATE/privileged.yml",
    "chars": 884,
    "preview": "name: Privileged\ndescription: You are @tiangolo or he asked you directly to create an issue here. If not, check the othe"
  },
  {
    "path": ".github/dependabot.yml",
    "chars": 304,
    "preview": "version: 2\nupdates:\n  # GitHub Actions\n  - package-ecosystem: \"github-actions\"\n    directory: \"/\"\n    schedule:\n      in"
  },
  {
    "path": ".github/labeler.yml",
    "chars": 511,
    "preview": "docs:\n  - all:\n    - changed-files:\n      - any-glob-to-any-file:\n        - docs/**\n        - docs_src/**\n      - all-gl"
  },
  {
    "path": ".github/workflows/add-to-project.yml",
    "chars": 368,
    "preview": "name: Add to Project\n\non:\n  pull_request_target:\n  issues:\n    types:\n      - opened\n      - reopened\n\njobs:\n  add-to-pr"
  },
  {
    "path": ".github/workflows/build-docs.yml",
    "chars": 2320,
    "preview": "name: Build Docs\non:\n  push:\n    branches:\n      - main\n  pull_request:\n    types:\n      - opened\n      - synchronize\n\nj"
  },
  {
    "path": ".github/workflows/deploy-docs.yml",
    "chars": 2800,
    "preview": "name: Deploy Docs\non:\n  workflow_run:\n    workflows:\n      - Build Docs\n    types:\n      - completed\n\npermissions:\n  dep"
  },
  {
    "path": ".github/workflows/detect-conflicts.yml",
    "chars": 499,
    "preview": "name: \"Conflict detector\"\non:\n  push:\n  pull_request_target:\n    types: [synchronize]\n\njobs:\n  main:\n    permissions:\n  "
  },
  {
    "path": ".github/workflows/issue-manager.yml",
    "chars": 1869,
    "preview": "name: Issue Manager\n\non:\n  schedule:\n    - cron: \"13 18 * * *\"\n  issue_comment:\n    types:\n      - created\n  issues:\n   "
  },
  {
    "path": ".github/workflows/labeler.yml",
    "chars": 828,
    "preview": "name: Labels\non:\n  pull_request_target:\n    types:\n      - opened\n      - synchronize\n      - reopened\n      # For label"
  },
  {
    "path": ".github/workflows/latest-changes.yml",
    "chars": 1203,
    "preview": "name: Latest Changes\n\non:\n  pull_request_target:\n    branches:\n      - main\n    types:\n      - closed\n  workflow_dispatc"
  },
  {
    "path": ".github/workflows/pre-commit.yml",
    "chars": 2969,
    "preview": "name: pre-commit\n\non:\n  pull_request:\n    types:\n      - opened\n      - synchronize\n\nenv:\n  # Forks and Dependabot don't"
  },
  {
    "path": ".github/workflows/publish.yml",
    "chars": 860,
    "preview": "name: Publish\n\non:\n  release:\n    types:\n      - created\n  workflow_dispatch:\n    inputs:\n      debug_enabled:\n        d"
  },
  {
    "path": ".github/workflows/smokeshow.yml",
    "chars": 1522,
    "preview": "name: Smokeshow\n\non:\n  workflow_run:\n    workflows: [Test]\n    types: [completed]\n\npermissions:\n  statuses: write\n\njobs:"
  },
  {
    "path": ".github/workflows/test-redistribute.yml",
    "chars": 1532,
    "preview": "name: Test Redistribute\n\non:\n  push:\n    branches:\n      - main\n  pull_request:\n    types:\n      - opened\n      - synchr"
  },
  {
    "path": ".github/workflows/test.yml",
    "chars": 4001,
    "preview": "name: Test\n\non:\n  push:\n    branches:\n      - main\n  pull_request:\n    types:\n      - opened\n      - synchronize\n  workf"
  },
  {
    "path": ".gitignore",
    "chars": 116,
    "preview": "*.pyc\n.mypy_cache\n.vscode\n.idea\npoetry.lock\ndist\nhtmlcov\n*.egg-info\n.coverage*\ncoverage.xml\nsite\n*.db\n.cache\n.venv*\n"
  },
  {
    "path": ".pre-commit-config.yaml",
    "chars": 1510,
    "preview": "# See https://pre-commit.com for more information\n# See https://pre-commit.com/hooks.html for more hooks\nrepos:\n  - repo"
  },
  {
    "path": ".python-version",
    "chars": 5,
    "preview": "3.10\n"
  },
  {
    "path": "CITATION.cff",
    "chars": 620,
    "preview": "# This CITATION.cff file was generated with cffinit.\n# Visit https://bit.ly/cffinit to generate yours today!\n\ncff-versio"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 128,
    "preview": "Please read the [Development - Contributing](https://sqlmodel.tiangolo.com/contributing/) guidelines in the documentatio"
  },
  {
    "path": "LICENSE",
    "chars": 1084,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2021 Sebastián Ramírez\n\nPermission is hereby granted, free of charge, to any person"
  },
  {
    "path": "README.md",
    "chars": 8486,
    "preview": "<p align=\"center\">\n  <a href=\"https://sqlmodel.tiangolo.com\"><img src=\"https://sqlmodel.tiangolo.com/img/logo-margin/log"
  },
  {
    "path": "SECURITY.md",
    "chars": 1169,
    "preview": "# Security Policy\n\nSecurity is very important for SQLModel and its community. 🔒\n\nLearn more about it below. 👇\n\n## Versio"
  },
  {
    "path": "data/members.yml",
    "chars": 45,
    "preview": "members:\n- login: tiangolo\n- login: alejsdev\n"
  },
  {
    "path": "data/sponsors.yml",
    "chars": 181,
    "preview": "gold: []\nsilver:\n  - url: https://www.govcert.lu\n    title: This project is being supported by GOVCERT.LU\n    img: https"
  },
  {
    "path": "docs/about/index.md",
    "chars": 66,
    "preview": "# About\n\nAbout **SQLModel**, its design, inspiration, and more. 🤓\n"
  },
  {
    "path": "docs/advanced/decimal.md",
    "chars": 4775,
    "preview": "# Decimal Numbers\n\nIn some cases you might need to be able to store decimal numbers with guarantees about the precision."
  },
  {
    "path": "docs/advanced/index.md",
    "chars": 308,
    "preview": "# Advanced User Guide\n\nThe **Advanced User Guide** is gradually growing, you can already read about some advanced topics"
  },
  {
    "path": "docs/advanced/uuid.md",
    "chars": 7700,
    "preview": "# UUID (Universally Unique Identifiers)\n\nWe have discussed some data types like `str`, `int`, etc.\n\nThere's another data"
  },
  {
    "path": "docs/alternatives.md",
    "chars": 60,
    "preview": "# Alternatives, Inspiration and Comparisons\n\nComing soon...\n"
  },
  {
    "path": "docs/contributing.md",
    "chars": 6223,
    "preview": "# Contributing\n\nFirst, you might want to see the basic ways to [help SQLModel and get help](help.md){.internal-link targ"
  },
  {
    "path": "docs/css/custom.css",
    "chars": 4661,
    "preview": "/* Fira Code, including characters used by Rich output, like the \"heavy right-pointing angle bracket ornament\", not incl"
  },
  {
    "path": "docs/css/termynal.css",
    "chars": 2271,
    "preview": "/**\n * termynal.js\n *\n * @author Ines Montani <ines@ines.io>\n * @version 0.0.1\n * @license MIT\n */\n\n:root {\n    --color-"
  },
  {
    "path": "docs/databases.md",
    "chars": 15000,
    "preview": "# Intro to Databases\n\n/// info\n\nAre you a seasoned developer and already know everything about databases? 🤓\n\nThen you ca"
  },
  {
    "path": "docs/db-to-code.md",
    "chars": 9962,
    "preview": "# Database to Code (ORMs)\n\nHere I'll tell you how **SQLModel** interacts with the database, why you would want to use it"
  },
  {
    "path": "docs/environment-variables.md",
    "chars": 8254,
    "preview": "# Environment Variables\n\nBefore we jump into code, let's cover a bit some of the **basics** that we'll need to understan"
  },
  {
    "path": "docs/features.md",
    "chars": 5270,
    "preview": "# Features\n\n## Designed for **FastAPI**\n\n**SQLModel** was created by the same <a href=\"https://tiangolo.com/\" class=\"ext"
  },
  {
    "path": "docs/help.md",
    "chars": 12179,
    "preview": "# Help SQLModel - Get Help\n\nDo you like **SQLModel**?\n\nWould you like to help SQLModel, other users, and the author?\n\nOr"
  },
  {
    "path": "docs/index.md",
    "chars": 8944,
    "preview": "<style>\n.md-content .md-typeset h1 { display: none; }\n</style>\n\n<p align=\"center\">\n  <a href=\"https://sqlmodel.tiangolo."
  },
  {
    "path": "docs/install.md",
    "chars": 2259,
    "preview": "# Install **SQLModel**\n\nCreate a project directory, create a [virtual environment](virtual-environments.md){.internal-li"
  },
  {
    "path": "docs/js/custom.js",
    "chars": 5741,
    "preview": "function setupTermynal() {\n    document.querySelectorAll(\".use-termynal\").forEach(node => {\n        node.style.display ="
  },
  {
    "path": "docs/js/termynal.js",
    "chars": 9523,
    "preview": "/**\n * termynal.js\n * A lightweight, modern and extensible animated terminal window, using\n * async/await.\n *\n * @author"
  },
  {
    "path": "docs/learn/index.md",
    "chars": 271,
    "preview": "# Learn\n\nLearn how to use **SQLModel** here.\n\nThis includes an introduction to **databases**, **SQL**, how to interact w"
  },
  {
    "path": "docs/management-tasks.md",
    "chars": 8664,
    "preview": "# Repository Management Tasks\n\nThese are the tasks that can be performed to manage the SQLModel repository by [team memb"
  },
  {
    "path": "docs/management.md",
    "chars": 1825,
    "preview": "# Repository Management\n\nHere's a short description of how the SQLModel repository is managed and maintained.\n\n## Owner\n"
  },
  {
    "path": "docs/overrides/main.html",
    "chars": 26,
    "preview": "{% extends \"base.html\" %}\n"
  },
  {
    "path": "docs/release-notes.md",
    "chars": 89482,
    "preview": "# Release Notes\n\n## Latest Changes\n\n### Fixes\n\n* 🐛 Fix `tuple_` return type annotation. PR [#1639](https://github.com/fa"
  },
  {
    "path": "docs/resources/index.md",
    "chars": 101,
    "preview": "# Resources\n\nAdditional resources, how to **help** and get help, how to **contribute**, and more. ✈️\n"
  },
  {
    "path": "docs/tutorial/automatic-id-none-refresh.md",
    "chars": 16057,
    "preview": "# Automatic IDs, None Defaults, and Refreshing Data\n\nIn the previous chapter, we saw how to add rows to the database usi"
  },
  {
    "path": "docs/tutorial/code-structure.md",
    "chars": 9140,
    "preview": "# Code Structure and Multiple Files\n\nLet's stop for a second to think about how to structure the code, particularly in *"
  },
  {
    "path": "docs/tutorial/connect/create-connected-rows.md",
    "chars": 7282,
    "preview": "# Create and Connect Rows\n\nWe will now **create rows** for each table. ✨\n\nThe `team` table will look like this:\n\n<table>"
  },
  {
    "path": "docs/tutorial/connect/create-connected-tables.md",
    "chars": 6856,
    "preview": "# Create Connected Tables\n\nNow we will deal with **connected** data put in different tables.\n\nSo, the first step is to c"
  },
  {
    "path": "docs/tutorial/connect/index.md",
    "chars": 703,
    "preview": "# Connect Tables - JOIN - Intro\n\nBy this point, you already know how to perform the main <abbr title=\"Create, read, upda"
  },
  {
    "path": "docs/tutorial/connect/read-connected-data.md",
    "chars": 16169,
    "preview": "# Read Connected Data\n\nNow that we have some data in both tables, let's select the data that is connected together.\n\nThe"
  },
  {
    "path": "docs/tutorial/connect/remove-data-connections.md",
    "chars": 2341,
    "preview": "# Remove Data Connections\n\nWe currently have a `team` table:\n\n<table>\n<tr>\n<th>id</th><th>name</th><th>headquarters</th>"
  },
  {
    "path": "docs/tutorial/connect/update-data-connections.md",
    "chars": 2311,
    "preview": "# Update Data Connections\n\nAt this point we have a `team` table:\n\n<table>\n<tr>\n<th>id</th><th>name</th><th>headquarters<"
  },
  {
    "path": "docs/tutorial/create-db-and-table-with-db-browser.md",
    "chars": 6550,
    "preview": "# Create a Table with SQL\n\nLet's get started!\n\nWe will:\n\n* Create a SQLite database with **DB Browser for SQLite**\n* Cre"
  },
  {
    "path": "docs/tutorial/create-db-and-table.md",
    "chars": 19841,
    "preview": "# Create a Table with SQLModel - Use the Engine\n\nNow let's get to the code. 👩‍💻\n\nMake sure you are inside of your projec"
  },
  {
    "path": "docs/tutorial/delete.md",
    "chars": 6603,
    "preview": "# Delete Data - DELETE\n\nNow let's delete some data using **SQLModel**.\n\n## Continue From Previous Code\n\nAs before, we'll"
  },
  {
    "path": "docs/tutorial/fastapi/delete.md",
    "chars": 877,
    "preview": "# Delete Data with FastAPI\n\nLet's now add a *path operation* to delete a hero.\n\nThis is quite straightforward. 😁\n\n## Del"
  },
  {
    "path": "docs/tutorial/fastapi/index.md",
    "chars": 1370,
    "preview": "# FastAPI and Pydantic - Intro\n\nOne of the use cases where **SQLModel** shines the most, and the main one why it was bui"
  },
  {
    "path": "docs/tutorial/fastapi/limit-and-offset.md",
    "chars": 2311,
    "preview": "# Read Heroes with Limit and Offset with FastAPI\n\nWhen a client sends a request to get all the heroes, we have been retu"
  },
  {
    "path": "docs/tutorial/fastapi/multiple-models.md",
    "chars": 16887,
    "preview": "# Multiple Models with FastAPI\n\nWe have been using the same `Hero` model to declare the schema of the data we receive in"
  },
  {
    "path": "docs/tutorial/fastapi/read-one.md",
    "chars": 2005,
    "preview": "# Read One Model with FastAPI\n\nLet's now add a *path operation* to read a single model to our **FastAPI** application.\n\n"
  },
  {
    "path": "docs/tutorial/fastapi/relationships.md",
    "chars": 10321,
    "preview": "# Models with Relationships in FastAPI\n\nIf we go right now and read a single **hero** by ID, we get the hero data with t"
  },
  {
    "path": "docs/tutorial/fastapi/response-model.md",
    "chars": 3930,
    "preview": "# FastAPI Response Model with SQLModel\n\nNow I'll show you how to use FastAPI's `response_model` with **SQLModel**.\n\n## I"
  },
  {
    "path": "docs/tutorial/fastapi/session-with-dependency.md",
    "chars": 4999,
    "preview": "# Session with FastAPI Dependency\n\nBefore we keep adding things, let's change a bit how we get the session for each requ"
  },
  {
    "path": "docs/tutorial/fastapi/simple-hero-api.md",
    "chars": 9070,
    "preview": "# Simple Hero API with FastAPI\n\nLet's start by building a simple hero web API with **FastAPI**. ✨\n\n## Install **FastAPI*"
  },
  {
    "path": "docs/tutorial/fastapi/teams.md",
    "chars": 2860,
    "preview": "# FastAPI Path Operations for Teams - Other Models\n\nLet's now update the **FastAPI** application to handle data for team"
  },
  {
    "path": "docs/tutorial/fastapi/tests.md",
    "chars": 15899,
    "preview": "# Test Applications with FastAPI and SQLModel\n\nTo finish this group of chapters about **FastAPI** with **SQLModel**, let"
  },
  {
    "path": "docs/tutorial/fastapi/update-extra-data.md",
    "chars": 5986,
    "preview": "# Update with Extra Data (Hashed Passwords) with FastAPI\n\nIn the previous chapter I explained to you how to update data "
  },
  {
    "path": "docs/tutorial/fastapi/update.md",
    "chars": 5800,
    "preview": "# Update Data with FastAPI\n\nNow let's see how to update data in the database with a **FastAPI** *path operation*.\n\n## `H"
  },
  {
    "path": "docs/tutorial/index.md",
    "chars": 1631,
    "preview": "# Tutorial - User Guide\n\nIn this tutorial you will learn how to use **SQLModel**.\n\n## Type hints\n\nIf you need a refreshe"
  },
  {
    "path": "docs/tutorial/indexes.md",
    "chars": 18872,
    "preview": "# Indexes - Optimize Queries\n\nWe just saw how to get some data `WHERE` a **condition** is true. For example, where the h"
  },
  {
    "path": "docs/tutorial/insert.md",
    "chars": 12910,
    "preview": "# Create Rows - Use the Session - INSERT\n\nNow that we have a database and a table, we can start adding data.\n\nHere's a r"
  },
  {
    "path": "docs/tutorial/limit-and-offset.md",
    "chars": 7065,
    "preview": "# Read a Range of Data - LIMIT and OFFSET\n\nNow you know how to get a single row with `.one()`, `.first()`, and `session."
  },
  {
    "path": "docs/tutorial/many-to-many/create-data.md",
    "chars": 5095,
    "preview": "# Create Data with Many-to-Many Relationships\n\nLet's continue from where we left and create some data.\n\nWe'll create dat"
  },
  {
    "path": "docs/tutorial/many-to-many/create-models-with-link.md",
    "chars": 3921,
    "preview": "# Create Models with a Many-to-Many Link\n\nWe'll now support **many-to-many** relationships using a **link table** like t"
  },
  {
    "path": "docs/tutorial/many-to-many/index.md",
    "chars": 5725,
    "preview": "# Many to Many - Intro\n\nWe saw how to work with <abbr title=\"Also called Many-to-One\">One-to-Many</abbr> relationships i"
  },
  {
    "path": "docs/tutorial/many-to-many/link-with-extra-fields.md",
    "chars": 11951,
    "preview": "# Link Model with Extra Fields\n\nIn the previous example we never interacted directly with the `HeroTeamLink` model, it w"
  },
  {
    "path": "docs/tutorial/many-to-many/update-remove-relationships.md",
    "chars": 7595,
    "preview": "# Update and Remove Many-to-Many Relationships\n\nNow we'll see how to update and remove these **many-to-many** relationsh"
  },
  {
    "path": "docs/tutorial/one.md",
    "chars": 7728,
    "preview": "# Read One Row\n\nYou already know how to filter rows to select using `.where()`.\n\nAnd you saw how when executing a `selec"
  },
  {
    "path": "docs/tutorial/relationship-attributes/back-populates.md",
    "chars": 9327,
    "preview": "# Relationship back_populates\n\nNow you know how to use the **relationship attributes** to manipulate connected data in t"
  },
  {
    "path": "docs/tutorial/relationship-attributes/cascade-delete-relationships.md",
    "chars": 24814,
    "preview": "# Cascade Delete Relationships\n\nWhat happens if we **delete** a team that has a **relationship** with heroes?\n\nShould th"
  },
  {
    "path": "docs/tutorial/relationship-attributes/create-and-update-relationships.md",
    "chars": 4745,
    "preview": "# Create and Update Relationships\n\nLet's see now how to create data with relationships using these new **relationship at"
  },
  {
    "path": "docs/tutorial/relationship-attributes/define-relationships-attributes.md",
    "chars": 3656,
    "preview": "# Define Relationships Attributes\n\nNow we are finally in one of the most exciting parts of **SQLModel**.\n\nRelationship A"
  },
  {
    "path": "docs/tutorial/relationship-attributes/index.md",
    "chars": 835,
    "preview": "# Relationship Attributes - Intro\n\nIn the previous chapters we discussed how to manage databases with tables that have *"
  },
  {
    "path": "docs/tutorial/relationship-attributes/read-relationships.md",
    "chars": 2837,
    "preview": "# Read Relationships\n\nNow that we know how to connect data using **relationship Attributes**, let's see how to get and r"
  },
  {
    "path": "docs/tutorial/relationship-attributes/remove-relationships.md",
    "chars": 908,
    "preview": "# Remove Relationships\n\nNow let's say that **Spider-Boy** tells **Rusty-Man** something like:\n\n> I don't feel so good Mr"
  },
  {
    "path": "docs/tutorial/relationship-attributes/type-annotation-strings.md",
    "chars": 1153,
    "preview": "## About the String in `list[\"Hero\"]`\n\nIn the first Relationship attribute, we declare it with `list[\"Hero\"]`, putting t"
  },
  {
    "path": "docs/tutorial/select.md",
    "chars": 13852,
    "preview": "# Read Data - SELECT\n\nWe already have a database and a table with some data in it that looks more or less like this:\n\n<t"
  },
  {
    "path": "docs/tutorial/update.md",
    "chars": 7429,
    "preview": "# Update Data - UPDATE\n\nNow let's see how to update data using **SQLModel**.\n\n## Continue From Previous Code\n\nAs before,"
  },
  {
    "path": "docs/tutorial/where.md",
    "chars": 21707,
    "preview": "# Filter Data - WHERE\n\nIn the previous chapter we saw how to `SELECT` data from the database.\n\nWe did it using pure **SQ"
  },
  {
    "path": "docs/virtual-environments.md",
    "chars": 22168,
    "preview": "# Virtual Environments\n\nWhen you work in Python projects you probably should use a **virtual environment** (or a similar"
  },
  {
    "path": "docs_src/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/advanced/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/advanced/decimal/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/advanced/decimal/tutorial001_py310.py",
    "chars": 1597,
    "preview": "from decimal import Decimal\n\nfrom sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Hero(SQLModel,"
  },
  {
    "path": "docs_src/advanced/uuid/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/advanced/uuid/tutorial001_py310.py",
    "chars": 1619,
    "preview": "import uuid\n\nfrom sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Hero(SQLModel, table=True):\n  "
  },
  {
    "path": "docs_src/advanced/uuid/tutorial002_py310.py",
    "chars": 1549,
    "preview": "import uuid\n\nfrom sqlmodel import Field, Session, SQLModel, create_engine\n\n\nclass Hero(SQLModel, table=True):\n    id: uu"
  },
  {
    "path": "docs_src/tutorial/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/automatic_id_none_refresh/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/automatic_id_none_refresh/annotations/en/tutorial002.md",
    "chars": 10210,
    "preview": "1. Create the `hero_1`.\n\n    **Doesn't generate any output**.\n\n2. Create the `hero_2`.\n\n    **Doesn't generate any outpu"
  },
  {
    "path": "docs_src/tutorial/automatic_id_none_refresh/tutorial001_py310.py",
    "chars": 2049,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine\n\n\nclass Hero(SQLModel, table=True):\n    id: int | None = Fi"
  },
  {
    "path": "docs_src/tutorial/automatic_id_none_refresh/tutorial002_py310.py",
    "chars": 2403,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine\n\n\nclass Hero(SQLModel, table=True):\n    id: int | None = Fi"
  },
  {
    "path": "docs_src/tutorial/code_structure/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/code_structure/tutorial001_py310/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/code_structure/tutorial001_py310/app.py",
    "chars": 667,
    "preview": "from sqlmodel import Session\n\nfrom .database import create_db_and_tables, engine\nfrom .models import Hero, Team\n\n\ndef cr"
  },
  {
    "path": "docs_src/tutorial/code_structure/tutorial001_py310/database.py",
    "chars": 231,
    "preview": "from sqlmodel import SQLModel, create_engine\n\nsqlite_file_name = \"database.db\"\nsqlite_url = f\"sqlite:///{sqlite_file_nam"
  },
  {
    "path": "docs_src/tutorial/code_structure/tutorial001_py310/models.py",
    "chars": 602,
    "preview": "from sqlmodel import Field, Relationship, SQLModel\n\n\nclass Team(SQLModel, table=True):\n    id: int | None = Field(defaul"
  },
  {
    "path": "docs_src/tutorial/code_structure/tutorial002_py310/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/code_structure/tutorial002_py310/app.py",
    "chars": 694,
    "preview": "from sqlmodel import Session\n\nfrom .database import create_db_and_tables, engine\nfrom .hero_model import Hero\nfrom .team"
  },
  {
    "path": "docs_src/tutorial/code_structure/tutorial002_py310/database.py",
    "chars": 231,
    "preview": "from sqlmodel import SQLModel, create_engine\n\nsqlite_file_name = \"database.db\"\nsqlite_url = f\"sqlite:///{sqlite_file_nam"
  },
  {
    "path": "docs_src/tutorial/code_structure/tutorial002_py310/hero_model.py",
    "chars": 488,
    "preview": "from typing import TYPE_CHECKING, Optional\n\nfrom sqlmodel import Field, Relationship, SQLModel\n\nif TYPE_CHECKING:\n    fr"
  },
  {
    "path": "docs_src/tutorial/code_structure/tutorial002_py310/team_model.py",
    "chars": 352,
    "preview": "from typing import TYPE_CHECKING\n\nfrom sqlmodel import Field, Relationship, SQLModel\n\nif TYPE_CHECKING:\n    from .hero_m"
  },
  {
    "path": "docs_src/tutorial/connect/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/connect/create_tables/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/connect/create_tables/tutorial001_py310.py",
    "chars": 756,
    "preview": "from sqlmodel import Field, SQLModel, create_engine\n\n\nclass Team(SQLModel, table=True):\n    id: int | None = Field(defau"
  },
  {
    "path": "docs_src/tutorial/connect/delete/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/connect/delete/tutorial001_py310.py",
    "chars": 2273,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine\n\n\nclass Team(SQLModel, table=True):\n    id: int | None = Fi"
  },
  {
    "path": "docs_src/tutorial/connect/insert/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/connect/insert/tutorial001_py310.py",
    "chars": 1870,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine\n\n\nclass Team(SQLModel, table=True):\n    id: int | None = Fi"
  },
  {
    "path": "docs_src/tutorial/connect/select/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/connect/select/tutorial001_py310.py",
    "chars": 2153,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Team(SQLModel, table=True):\n    id: int | N"
  },
  {
    "path": "docs_src/tutorial/connect/select/tutorial002_py310.py",
    "chars": 2133,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Team(SQLModel, table=True):\n    id: int | N"
  },
  {
    "path": "docs_src/tutorial/connect/select/tutorial003_py310.py",
    "chars": 2147,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Team(SQLModel, table=True):\n    id: int | N"
  },
  {
    "path": "docs_src/tutorial/connect/select/tutorial004_py310.py",
    "chars": 2149,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Team(SQLModel, table=True):\n    id: int | N"
  },
  {
    "path": "docs_src/tutorial/connect/select/tutorial005_py310.py",
    "chars": 2176,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Team(SQLModel, table=True):\n    id: int | N"
  },
  {
    "path": "docs_src/tutorial/connect/update/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/connect/update/tutorial001_py310.py",
    "chars": 2075,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine\n\n\nclass Team(SQLModel, table=True):\n    id: int | None = Fi"
  },
  {
    "path": "docs_src/tutorial/create_db_and_table/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/create_db_and_table/annotations/en/tutorial003.md",
    "chars": 2308,
    "preview": "1. Import `Optional` from `typing` to declare fields that could be `None`.\n2. Import the things we will need from `sqlmo"
  },
  {
    "path": "docs_src/tutorial/create_db_and_table/tutorial001_py310.py",
    "chars": 374,
    "preview": "from sqlmodel import Field, SQLModel, create_engine\n\n\nclass Hero(SQLModel, table=True):\n    id: int | None = Field(defau"
  },
  {
    "path": "docs_src/tutorial/create_db_and_table/tutorial002_py310.py",
    "chars": 463,
    "preview": "from sqlmodel import Field, SQLModel, create_engine\n\n\nclass Hero(SQLModel, table=True):\n    id: int | None = Field(defau"
  },
  {
    "path": "docs_src/tutorial/create_db_and_table/tutorial003_py310.py",
    "chars": 572,
    "preview": "from sqlmodel import Field, SQLModel, create_engine  # (2)!\n\n\nclass Hero(SQLModel, table=True):  # (3)!\n    id: int | No"
  },
  {
    "path": "docs_src/tutorial/delete/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/delete/annotations/en/tutorial002.md",
    "chars": 2454,
    "preview": "1. Select the hero we will delete.\n\n2. Execute the query with the select statement object.\n\n    This generates the outpu"
  },
  {
    "path": "docs_src/tutorial/delete/tutorial001_py310.py",
    "chars": 2761,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Hero(SQLModel, table=True):\n    id: int | N"
  },
  {
    "path": "docs_src/tutorial/delete/tutorial002_py310.py",
    "chars": 2872,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Hero(SQLModel, table=True):\n    id: int | N"
  },
  {
    "path": "docs_src/tutorial/fastapi/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_001.md",
    "chars": 779,
    "preview": "1. Import the `app` from the the `main` module.\n\n2. We create a `TestClient` for the FastAPI `app` and put it in the var"
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_002.md",
    "chars": 1639,
    "preview": "1. Import the `get_session` dependency from the the `main` module.\n\n2. Define the new function that will be the new **de"
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_003.md",
    "chars": 1789,
    "preview": "1. Here's a subtle thing to notice.\n\n    Remember that [Order Matters](../create-db-and-table.md#sqlmodel-metadata-order"
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_004.md",
    "chars": 1089,
    "preview": "1. Import `StaticPool` from `sqlmodel`, we will use it in a bit.\n\n2. For the **SQLite URL**, don't write any file name, "
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_005.md",
    "chars": 2103,
    "preview": "1. Import `pytest`.\n\n2. Use the `@pytest.fixture()` decorator on top of the function to tell pytest that this is a **fix"
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_006.md",
    "chars": 949,
    "preview": "1. Create the new fixture named `\"client\"`.\n\n2. This **client fixture**, in turn, also requires the **session fixture**."
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/main.py",
    "chars": 2604,
    "preview": "from fastapi import Depends, FastAPI, HTTPException, Query\nfrom sqlmodel import Field, Session, SQLModel, create_engine,"
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_extra_coverage.py",
    "chars": 1208,
    "preview": "from fastapi.testclient import TestClient\nfrom sqlalchemy import Inspector, inspect\nfrom sqlmodel import Session, create"
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main.py",
    "chars": 3626,
    "preview": "import pytest\nfrom fastapi.testclient import TestClient\nfrom sqlmodel import Session, SQLModel, create_engine\nfrom sqlmo"
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_001.py",
    "chars": 991,
    "preview": "from fastapi.testclient import TestClient\nfrom sqlmodel import Session, SQLModel, create_engine\n\nfrom .main import app, "
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_002.py",
    "chars": 959,
    "preview": "from fastapi.testclient import TestClient\nfrom sqlmodel import Session, SQLModel, create_engine\n\nfrom .main import app, "
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_003.py",
    "chars": 978,
    "preview": "from fastapi.testclient import TestClient\nfrom sqlmodel import Session, SQLModel, create_engine\n\nfrom .main import app, "
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_004.py",
    "chars": 1008,
    "preview": "from fastapi.testclient import TestClient\nfrom sqlmodel import Session, SQLModel, create_engine\nfrom sqlmodel.pool impor"
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_005.py",
    "chars": 1066,
    "preview": "import pytest  # (1)!\nfrom fastapi.testclient import TestClient\nfrom sqlmodel import Session, SQLModel, create_engine\nfr"
  },
  {
    "path": "docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_006.py",
    "chars": 1171,
    "preview": "import pytest\nfrom fastapi.testclient import TestClient\nfrom sqlmodel import Session, SQLModel, create_engine\nfrom sqlmo"
  },
  {
    "path": "docs_src/tutorial/fastapi/delete/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/fastapi/delete/tutorial001_py310.py",
    "chars": 2559,
    "preview": "from fastapi import FastAPI, HTTPException, Query\nfrom sqlmodel import Field, Session, SQLModel, create_engine, select\n\n"
  },
  {
    "path": "docs_src/tutorial/fastapi/limit_and_offset/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/fastapi/limit_and_offset/tutorial001_py310.py",
    "chars": 1618,
    "preview": "from fastapi import FastAPI, HTTPException, Query\nfrom sqlmodel import Field, Session, SQLModel, create_engine, select\n\n"
  },
  {
    "path": "docs_src/tutorial/fastapi/multiple_models/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/fastapi/multiple_models/tutorial001_py310.py",
    "chars": 1317,
    "preview": "from fastapi import FastAPI\nfrom sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Hero(SQLModel, "
  },
  {
    "path": "docs_src/tutorial/fastapi/multiple_models/tutorial002_py310.py",
    "chars": 1230,
    "preview": "from fastapi import FastAPI\nfrom sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass HeroBase(SQLMod"
  },
  {
    "path": "docs_src/tutorial/fastapi/read_one/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/fastapi/read_one/tutorial001_py310.py",
    "chars": 1527,
    "preview": "from fastapi import FastAPI, HTTPException\nfrom sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass "
  },
  {
    "path": "docs_src/tutorial/fastapi/relationships/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/fastapi/relationships/tutorial001_py310.py",
    "chars": 5004,
    "preview": "from fastapi import Depends, FastAPI, HTTPException, Query\nfrom sqlmodel import Field, Relationship, Session, SQLModel, "
  },
  {
    "path": "docs_src/tutorial/fastapi/response_model/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/fastapi/response_model/tutorial001_py310.py",
    "chars": 1050,
    "preview": "from fastapi import FastAPI\nfrom sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Hero(SQLModel, "
  },
  {
    "path": "docs_src/tutorial/fastapi/session_with_dependency/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py310.py",
    "chars": 2604,
    "preview": "from fastapi import Depends, FastAPI, HTTPException, Query\nfrom sqlmodel import Field, Session, SQLModel, create_engine,"
  },
  {
    "path": "docs_src/tutorial/fastapi/simple_hero_api/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/fastapi/simple_hero_api/tutorial001_py310.py",
    "chars": 1002,
    "preview": "from fastapi import FastAPI\nfrom sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Hero(SQLModel, "
  },
  {
    "path": "docs_src/tutorial/fastapi/teams/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/fastapi/teams/tutorial001_py310.py",
    "chars": 4809,
    "preview": "from fastapi import Depends, FastAPI, HTTPException, Query\nfrom sqlmodel import Field, Relationship, Session, SQLModel, "
  },
  {
    "path": "docs_src/tutorial/fastapi/update/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/fastapi/update/tutorial001_py310.py",
    "chars": 2237,
    "preview": "from fastapi import FastAPI, HTTPException, Query\nfrom sqlmodel import Field, Session, SQLModel, create_engine, select\n\n"
  },
  {
    "path": "docs_src/tutorial/fastapi/update/tutorial002_py310.py",
    "chars": 2810,
    "preview": "from fastapi import FastAPI, HTTPException, Query\nfrom sqlmodel import Field, Session, SQLModel, create_engine, select\n\n"
  },
  {
    "path": "docs_src/tutorial/indexes/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/indexes/tutorial001_py310.py",
    "chars": 1184,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Hero(SQLModel, table=True):\n    id: int | N"
  },
  {
    "path": "docs_src/tutorial/indexes/tutorial002_py310.py",
    "chars": 1596,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Hero(SQLModel, table=True):\n    id: int | N"
  },
  {
    "path": "docs_src/tutorial/insert/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/insert/annotations/en/tutorial003.md",
    "chars": 1968,
    "preview": "1. We use a function `create_heroes()` to put this logic together.\n\n2. Create each of the objects/instances of the `Hero"
  },
  {
    "path": "docs_src/tutorial/insert/tutorial001_py310.py",
    "chars": 889,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine\n\n\nclass Hero(SQLModel, table=True):\n    id: int | None = Fi"
  },
  {
    "path": "docs_src/tutorial/insert/tutorial002_py310.py",
    "chars": 890,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine\n\n\nclass Hero(SQLModel, table=True):\n    id: int | None = Fi"
  },
  {
    "path": "docs_src/tutorial/insert/tutorial003_py310.py",
    "chars": 983,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine\n\n\nclass Hero(SQLModel, table=True):\n    id: int | None = Fi"
  },
  {
    "path": "docs_src/tutorial/many_to_many/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/many_to_many/tutorial001_py310.py",
    "chars": 2356,
    "preview": "from sqlmodel import Field, Relationship, Session, SQLModel, create_engine\n\n\nclass HeroTeamLink(SQLModel, table=True):\n "
  },
  {
    "path": "docs_src/tutorial/many_to_many/tutorial002_py310.py",
    "chars": 3125,
    "preview": "from sqlmodel import Field, Relationship, Session, SQLModel, create_engine, select\n\n\nclass HeroTeamLink(SQLModel, table="
  },
  {
    "path": "docs_src/tutorial/many_to_many/tutorial003_py310.py",
    "chars": 3756,
    "preview": "from sqlmodel import Field, Relationship, Session, SQLModel, create_engine, select\n\n\nclass HeroTeamLink(SQLModel, table="
  },
  {
    "path": "docs_src/tutorial/offset_and_limit/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs_src/tutorial/offset_and_limit/tutorial001_py310.py",
    "chars": 1583,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Hero(SQLModel, table=True):\n    id: int | N"
  },
  {
    "path": "docs_src/tutorial/offset_and_limit/tutorial002_py310.py",
    "chars": 1593,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Hero(SQLModel, table=True):\n    id: int | N"
  },
  {
    "path": "docs_src/tutorial/offset_and_limit/tutorial003_py310.py",
    "chars": 1593,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Hero(SQLModel, table=True):\n    id: int | N"
  },
  {
    "path": "docs_src/tutorial/offset_and_limit/tutorial004_py310.py",
    "chars": 1614,
    "preview": "from sqlmodel import Field, Session, SQLModel, create_engine, select\n\n\nclass Hero(SQLModel, table=True):\n    id: int | N"
  }
]

// ... and 234 more files (download for full content)

About this extraction

This page contains the full source code of the fastapi/sqlmodel GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 434 files (1.2 MB), approximately 326.8k tokens, and a symbol index with 1008 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!