Install SQLModel
Install the SQLModel package and verify the installation
💻
Writing code and entering commands is only available on desktop. Open this page on a larger screen to complete this chapter.
What you are installing
SQLModel is the only new dependency for this course. It bundles everything needed to connect Python classes to a SQLite database:
| Included | Purpose |
|---|---|
| SQLModel | Maps Python classes to database tables |
| SQLAlchemy | The database engine SQLModel builds on |
| Pydantic v2 | Validation — you already have this from FastAPI |
After installing, verify the package is available by printing its version.
Instructions
Install SQLModel and verify the installation.
- Install
sqlmodelwithpip install sqlmodel. - Verify the installation by running
python -c "import sqlmodel; print(sqlmodel.__version__)".
Interactive Code Editor
Sign in to write and run code, track your progress, and unlock all chapters.
Sign In to Start Coding