sqlmodel/docs/release-notes.md
2022-08-27 21:09:00 +00:00

11 KiB

Release Notes

Latest Changes

  • ✏ Fix typo in docs/tutorial/code-structure.md. PR #344 by @marciomazza.
  • ✏ Fix typo in docs/db-to-code.md. PR #155 by @gr8jam.
  • ✏ Fix typo in docs/contributing.md. PR #323 by @Fardad13.
  • ✏ Fix typo in docs/tutorial/fastapi/tests.md. PR #265 by @johnhoman.
  • ✏ Fix typo in docs/tutorial/where.md. PR #286 by @jalvaradosegura.
  • ✏ Fix typos in docs/tutorial/fastapi/update.md. PR #268 by @cirrusj.
  • ✏ Fix typo in docs/tutorial/fastapi/simple-hero-api.md. PR #247 by @hao-wang.
  • ✏ Fix typos in docs/tutorial/automatic-id-none-refresh.md, docs/tutorial/fastapi/update.md, docs/tutorial/select.md. PR #185 by @rootux.
  • ✏ Fix typo in docs/databases.md. PR #177 by @seandlg.
  • ✏ Fix typos in docs/tutorial/fastapi/update.md. PR #162 by @wmcgee3.
  • ✏ Fix typos in docs/tutorial/code-structure.md, docs/tutorial/fastapi/multiple-models.md, docs/tutorial/fastapi/simple-hero-api.md, docs/tutorial/many-to-many/index.md. PR #116 by @moonso.
  • ✏ Fix typo in docs/tutorial/fastapi/teams.md. PR #154 by @chrisgoddard.
  • ✏ Fix typo variable in example about relationships and back_populates, always use hero instead of owner. PR #120 by @onionj.
  • ✏ Fix typo in docs/tutorial/fastapi/tests.md. PR #113 by @feanil.
  • ✏ Fix typo in docs/tutorial/where.md. PR #72 by @ZettZet.
  • ✏ Fix typo in docs/tutorial/code-structure.md. PR #91 by @dhiraj.
  • ✏ Fix broken link to newsletter sign-up in docs/help.md. PR #84 by @mborus.
  • ⬆ Update development requirement for FastAPI from ^0.68.0 to ^0.68.1. PR #48 by @alucarddelta.
  • ✏ Fix typos in docs/tutorial/many-to-many/create-models-with-link.md. PR #45 by @xginn8.
  • Raise an exception when using a Pydantic field type with no matching SQLAlchemy type. PR #18 by @elben10.
  • Revert upgrade Poetry, to make a release that supports Python 3.6 first. PR #417 by @tiangolo.
  • 👷 Add dependabot for GitHub Actions. PR #410 by @tiangolo.
  • ⬆️ Upgrade Poetry to version ==1.2.0b1. PR #303 by @tiangolo.
  • ✏ Fix typo in docs/tutorial/index.md. PR #398 by @ryangrose.
  • ⬆ Upgrade constrain for SQLAlchemy = ">=1.4.17,<=1.4.41". PR #371 by @RobertRosca.
  • 🐛 Fix SQLAlchemy version 1.4.36 breaks SQLModel relationships (#315). PR #322 by @byrman.
  • 👷 Add CI for Python 3.10. PR #305 by @tiangolo.
  • 📝 Add Jina's QA Bot to the docs to help people that want to ask quick questions. PR #263 by @tiangolo.
  • 👷 Upgrade Codecov GitHub Action. PR #304 by @tiangolo.
  • Add new Session.get() parameter execution_options. PR #302 by @tiangolo.
  • 💚 Only run CI on push when on master, to avoid duplicate runs on PRs. PR #244 by @tiangolo.
  • 🔧 Upgrade MkDocs Material and update configs. PR #217 by @tiangolo.
  • ⬆ Upgrade mypy, fix type annotations. PR #218 by @tiangolo.

0.0.6

Breaking Changes

SQLModel no longer creates indexes by default for every column, indexes are now opt-in. You can read more about it in PR #205.

Before this change, if you had a model like this:

from typing import Optional

from sqlmodel import Field, SQLModel


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

...when creating the tables, SQLModel version 0.0.5 and below, would also create an index for name, one for secret_name, and one for age (id is the primary key, so it doesn't need an additional index).

If you depended on having an index for each one of those columns, now you can (and would have to) define them explicitly:

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

There's a high chance you don't need indexes for all the columns. For example, you might only need indexes for name and age, but not for secret_name. In that case, you could define the model as:

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

If you already created your database tables with SQLModel using versions 0.0.5 or below, it would have also created those indexes in the database. In that case, you might want to manually drop (remove) some of those indexes, if they are unnecessary, to avoid the extra cost in performance and space.

Depending on the database you are using, there will be a different way to find the available indexes.

For example, let's say you no longer need the index for secret_name. You could check the current indexes in the database and find the one for secret_name, it could be named ix_hero_secret_name. Then you can remove it with SQL:

DROP INDEX ix_hero_secret_name

or

DROP INDEX ix_hero_secret_name ON hero;

Here's the new, extensive documentation explaining indexes and how to use them: Indexes - Optimize Queries.

Docs

0.0.5

Features

Docs

  • ✏ Update decimal tutorial source for consistency. PR #188 by @tiangolo.

Internal

  • 🔧 Split MkDocs insiders build in CI to support building from PRs. PR #186 by @tiangolo.
  • 🎨 Format expression.py and expression template, currently needed by CI. PR #187 by @tiangolo.
  • 🐛Fix docs light/dark theme switcher. PR #1 by @Lehoczky.
  • 🔧 Add MkDocs Material social cards. PR #90 by @tiangolo.
  • Update type annotations and upgrade mypy. PR #173 by @tiangolo.

0.0.4

  • 🎨 Fix type detection of select results in PyCharm. PR #15 by @tiangolo.

0.0.3

  • ⬆️ Update and relax specification range for sqlalchemy-stubs. PR #4 by @tiangolo.

0.0.2

  • This includes several small bug fixes detected during the first CI runs.
  • 💚 Fix CI installs and tests. PR #2 by @tiangolo.

0.0.1

  • First release. 🎉