28 Commits

Author SHA1 Message Date
Sebastián Ramírez
8ed856d322
Upgrade SQLAlchemy to 2.0, including initial work by farahats9 (#700)
Co-authored-by: Mohamed Farahat <farahats9@yahoo.com>
Co-authored-by: Stefan Borer <stefan.borer@gmail.com>
Co-authored-by: Peter Landry <peter.landry@gmail.com>
2023-11-18 12:30:37 +01:00
Maruo.S
cbaf172c63
Add support for passing a custom SQLAlchemy type to Field() with sa_type (#505)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2023-10-29 12:10:39 +04:00
Sebastián Ramírez
717594ef13
Do not allow invalid combinations of field parameters for columns and relationships, sa_column excludes sa_column_args, primary_key, nullable, etc. (#681)
* ♻️ Make sa_column exclusive, do not allow incompatible arguments, sa_column_args, primary_key, etc

*  Add tests for new errors when incorrectly using sa_column

*  Add tests for sa_column_args and sa_column_kwargs

* ♻️ Do not allow sa_relationship with sa_relationship_args or sa_relationship_kwargs

*  Add tests for relationship errors

*  Fix test for sa_column_args
2023-10-28 17:55:23 +04:00
Daniil Fajnberg
99f8ce3894
Add support for all Field parameters from Pydantic 1.9.0 and above, make Pydantic 1.9.0 the minimum required version (#440)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2023-10-26 14:18:05 +04:00
Daniil Fajnberg
9809b5bc83
🐛 Fix allowing using a ForeignKey directly, remove repeated column construction from SQLModelMetaclass.__init__ and upgrade minimum SQLAlchemy to >=1.4.36 (#443)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2023-10-23 17:59:06 +04:00
Sebastián Ramírez
d3261cab59
🐛 Fix enum type checks ordering in get_sqlalchemy_type (#669)
Co-authored-by: Pierre Cheynier <p.cheynier@criteo.com>
2023-10-23 13:22:44 +04:00
Sebastián Ramírez
065fcdc828
👷 Move to Ruff and add pre-commit (#661)
* 👷 Add pre-commit

* 🔧 Add pyproject.toml config for Ruff

*  Replace isort, flake8, autoflake with Ruff

* 🔨 Update lint and format scripts

* 🎨 Format with Ruff

* 🔧 Update Poetry config
2023-10-23 07:34:50 +00:00
David Danier
840fd08ab2
Raise a more clear error when a type is not valid (#425)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2023-10-23 10:42:30 +04:00
byrman
d5219aa3c5
🐛 Fix SQLAlchemy version 1.4.36 breaks SQLModel relationships (#315) (#461)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2023-10-22 16:01:51 +04:00
Sebastián Ramírez
02bd7ebffd
🗑️ Deprecate Python 3.6 and upgrade Poetry and Poetry Version Plugin (#627) 2023-07-29 12:32:47 +02:00
Colin Marquardt
267cd42fb6
✏️ Fix typo in internal function name get_sqlachemy_type() (#496)
Corrected name is get_sqlalchemy_type().
2022-11-12 07:44:19 +01:00
Jonas Krüger Svensson
ae144e0a39
🐛 Fix auto detecting and setting nullable, allowing overrides in field (#423)
Co-authored-by: Benjamin Rapaport <br@getallstreet.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-08-30 18:18:32 +02:00
Yasser Tahiri
6216409f96
♻ Refactor internal statements to simplify code (#53) 2022-08-28 01:53:02 +02:00
Raphael Gibson
42b0e6eace
Allow setting unique in Field() for a column (#83)
Co-authored-by: Raphael Gibson <raphael.araujo@estantemagica.com.br>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-08-28 01:49:29 +02:00
phi-friday
5429e9b6aa
🐛 Fix type annotations for Model.parse_obj(), and Model.validate() (#321)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-08-28 01:22:09 +02:00
byrman
d380736043
🐛 Fix handling validators for non-default values (#253)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-08-27 23:10:23 +00:00
statt8900
680602b7eb
🐛 Fix fields marked as "set" in models (#117)
Co-authored-by: Michael Statt <michael.statt@modelyst.io>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-08-27 22:59:09 +00:00
Chris White
eef0b7770b
🐛 Fix Enum handling in SQLAlchemy (#165)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-08-28 00:48:44 +02:00
Evangelos Anagnostopoulos
9830ee0d89
🐛 Fix setting nullable property of Fields that don't accept None (#79)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-08-28 00:18:57 +02:00
Jakob Jul Elben
dc4dc42ec5
Raise an exception when using a Pydantic field type with no matching SQLAlchemy type (#18)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-08-27 20:13:32 +00:00
byrman
4dd7b890d4
🐛 Fix SQLAlchemy version 1.4.36 breaks SQLModel relationships (#315) (#322)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-08-27 20:10:38 +02:00
Sebastián Ramírez
8d1b6f079a
⬆ Upgrade mypy, fix type annotations (#218) 2022-01-08 16:36:19 +00:00
Sebastián Ramírez
155c6178cd
Document indexes and make them opt-in (#205) 2021-12-28 11:48:03 +01:00
robcxyz
580f372059
Add support for Decimal fields from Pydantic and SQLAlchemy (#103)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-12-13 12:30:20 +01:00
Sebastián Ramírez
e30c7ef4e9
Update type annotations and upgrade mypy (#173) 2021-11-30 17:12:28 +01:00
Sebastián Ramírez
7f8a1a5e3c
💚 Fix CI installs and tests (#2) 2021-08-24 20:14:33 +02:00
Sebastián Ramírez
46a6ed3d05 🐛 Re-implement unreleased Pydantic utility 2021-08-24 16:01:22 +02:00
Sebastián Ramírez
fcff2050e6 Add SQLModel core code 2021-08-24 14:41:53 +02:00