sqlmodel icon indicating copy to clipboard operation
sqlmodel copied to clipboard

✨ Add support for all `Field` parameters from Pydantic version `1.9.0`

Open daniil-berg opened this issue 3 years ago • 3 comments

Summary

The proposed changes add support for the following Field parameters:

  • max_digits
  • decimal_places
  • unique_items
  • discriminator
  • repr

This makes the SQLModel Field constructor support all Pydantic field parameters as of version 1.9.0 up until the current one (1.10.2).

Tests sub-package for Pydantic capabilities was added and tests for the new field parameters were included.

The Pydantic dependency was bumped to 1.9.0.

Fixes

  • #354 - more elegant solution
  • #356 - fulfills feature request

daniil-berg avatar Sep 07 '22 10:09 daniil-berg

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (ea79c47) 98.49% compared to head (57e05ab) 97.81%. Report is 94 commits behind head on main.

:exclamation: Current head 57e05ab differs from pull request most recent head 8bc6450. Consider uploading reports for the commit 8bc6450 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #440      +/-   ##
==========================================
- Coverage   98.49%   97.81%   -0.69%     
==========================================
  Files         185      188       +3     
  Lines        5856     6315     +459     
==========================================
+ Hits         5768     6177     +409     
- Misses         88      138      +50     
Files Coverage Δ
sqlmodel/main.py 85.50% <100.00%> (ø)
tests/test_pydantic/test_field.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Sep 07 '22 10:09 codecov[bot]

📝 Docs preview for commit 6728c25bec264152e84818b8c42fa3d480540cfc at: https://63186d6a24607c220a2e25b4--sqlmodel.netlify.app

github-actions[bot] avatar Sep 07 '22 10:09 github-actions[bot]

📝 Docs preview for commit 57e05abeda76179b96f4af629a3677c72d1a7e50 at: https://63187ebf24607c32762e235c--sqlmodel.netlify.app

github-actions[bot] avatar Sep 07 '22 11:09 github-actions[bot]

📝 Docs preview for commit 45d5eb1ee3903e4ceec4e6b239ee7df12039169c at: https://639ce0c089c20f00aba4cd75--sqlmodel.netlify.app

github-actions[bot] avatar Dec 16 '22 21:12 github-actions[bot]

@tiangolo Is there any planned timeline to merge this PR? Discriminator is a need for many developers (that's why pydantic released a support for it). It could really make our lives way better as devs using SQLModel.

Thanks

rotemvilsa avatar Jan 07 '23 08:01 rotemvilsa

@tiangolo any update on this?

pajowu avatar Mar 14 '23 15:03 pajowu

++ on updates

N-Demir avatar Sep 28 '23 01:09 N-Demir

📝 Docs preview for commit 5ff6d2a97edfc1fe9f467d9c6e7b128ccecdada3 at: https://de370077.sqlmodel.pages.dev

github-actions[bot] avatar Oct 25 '23 13:10 github-actions[bot]

Awesome, thank you @daniil-berg! 🚀

This will be available in the next version: 0.0.10 🎉

tiangolo avatar Oct 26 '23 10:10 tiangolo