Skip to content

Correct create_engine description in create-db-and-table tutorial#2037

Closed
anxkhn wants to merge 1 commit into
fastapi:mainfrom
anxkhn:patch-3
Closed

Correct create_engine description in create-db-and-table tutorial#2037
anxkhn wants to merge 1 commit into
fastapi:mainfrom
anxkhn:patch-3

Conversation

@anxkhn

@anxkhn anxkhn commented Jul 7, 2026

Copy link
Copy Markdown

The "Engine Technical Details" tip in the create-db-and-table tutorial describes
create_engine() in a way that no longer matches SQLModel:

SQLModel defines its own create_engine() function. It is the same as
SQLAlchemy's create_engine(), but with the difference that it defaults to use
future=True (which means that it uses the style of the latest SQLAlchemy, 1.4,
and the future 2.0).

And SQLModel's version of create_engine() is type annotated internally, ...

SQLModel no longer defines its own create_engine(). Since the SQLAlchemy 2.0
upgrade it is a direct re-export:

# sqlmodel/__init__.py
from sqlalchemy.engine import create_engine as create_engine

so sqlmodel.create_engine is sqlalchemy.create_engine is True. There is no
wrapper anymore, and the future=True / "latest SQLAlchemy, 1.4, and the future
2.0" framing is obsolete: pyproject.toml requires SQLAlchemy >=2.0.14,<2.1.0,
where the 2.0 style is the only mode and future is no longer a meaningful toggle
(SQLAlchemy 2.0 rejects future=False). The type annotations now come from
SQLAlchemy itself (create_engine returns an annotated Engine).

This updates the two sentences to say that SQLModel re-exports SQLAlchemy's
create_engine() directly, requires SQLAlchemy 2.0+, and that SQLAlchemy's
create_engine() is type annotated. Docs-only, no code change.

SQLModel re-exports SQLAlchemy's create_engine directly (sqlmodel.create_engine
is sqlalchemy.create_engine), it does not define its own wrapper. The previous
text described an obsolete future=True default and SQLAlchemy 1.4/2.0 framing
that no longer applies now that SQLModel requires SQLAlchemy 2.0.

Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
@github-actions github-actions Bot added the docs Improvements or additions to documentation label Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot closed this Jul 7, 2026
@YuriiMotov

Copy link
Copy Markdown
Member

@anxkhn, please, stop opening PRs with AI-tools!
Read: https://tiangolo.com/open-source/contributing/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maybe-ai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants