Skip to content

📝 Add documentation for unique and check constraints#1802

Open
bBlazewavE wants to merge 5 commits intofastapi:mainfrom
bBlazewavE:docs/add-constraints-guide
Open

📝 Add documentation for unique and check constraints#1802
bBlazewavE wants to merge 5 commits intofastapi:mainfrom
bBlazewavE:docs/add-constraints-guide

Conversation

@bBlazewavE
Copy link

Summary

Add documentation covering how to use database constraints with SQLModel.

Changes

  • Added docs/advanced/constraints.md with guide on:
    • Single-column unique constraints via Field(unique=True)
    • Multi-column unique constraints via __table_args__
    • Check constraints via __table_args__
    • Combining multiple constraints
  • Updated mkdocs.yml nav

Closes #82
Closes #292

Add a guide covering unique constraints (single and multi-column)
and check constraints using __table_args__.

Closes fastapi#82
Closes fastapi#292
@github-actions github-actions bot added the docs Improvements or additions to documentation label Mar 6, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to set check constraint in sql model? How to define unique constraint in table columns

1 participant