📝 Fix "Decimals in SQLModel" to reference Field() instead of condecimal()#2035
Open
anxkhn wants to merge 1 commit into
Open
📝 Fix "Decimals in SQLModel" to reference Field() instead of condecimal()#2035anxkhn wants to merge 1 commit into
Field() instead of condecimal()#2035anxkhn wants to merge 1 commit into
Conversation
…mal() The 'Decimals in SQLModel' section introduced its example with 'using the condecimal() function', but the example (and current SQLModel) uses Field(max_digits=..., decimal_places=...). condecimal() is a Pydantic v1 constrained-type helper that SQLModel does not re-export, and using it as an annotation trips static type checkers. Reword the sentence to match the paragraph above it and the code sample, both of which already use Field(). Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
Contributor
📝 Docs previewLast commit 884053d at: https://b0285440.sqlmodel.pages.dev Modified Pages |
Member
|
@anxkhn, the description is too verbose for such small fix.. |
Field() instead of condecimal()
YuriiMotov
approved these changes
Jul 15, 2026
YuriiMotov
left a comment
Member
There was a problem hiding this comment.
LGTM!
Added alternative wording (to avoid calling Field function)
| ## 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: | ||
| Let's say that each hero in the database will have an amount of money. We could make that field a `Decimal` type and set the number of digits and decimal places in the `Field()` function: |
Member
There was a problem hiding this comment.
Suggested change
| Let's say that each hero in the database will have an amount of money. We could make that field a `Decimal` type and set the number of digits and decimal places in the `Field()` function: | |
| Let's say that each hero in the database will have an amount of money. We can define that field as a `Decimal` and configure the maximum number of digits and decimal places using the parameters of `Field()`: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates one sentence in the Decimal documentation so the prose references
Field()and matches the example that follows. It also resolves the documentation issue reported in #354; no code is changed.