✨ Add support for passing a custom SQLAlchemy type to Field() with sa_type (#505)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
@@ -39,6 +39,17 @@ def test_sa_column_no_sa_kargs() -> None:
|
||||
)
|
||||
|
||||
|
||||
def test_sa_column_no_type() -> None:
|
||||
with pytest.raises(RuntimeError):
|
||||
|
||||
class Item(SQLModel, table=True):
|
||||
id: Optional[int] = Field(
|
||||
default=None,
|
||||
sa_type=Integer,
|
||||
sa_column=Column(Integer, primary_key=True),
|
||||
)
|
||||
|
||||
|
||||
def test_sa_column_no_primary_key() -> None:
|
||||
with pytest.raises(RuntimeError):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user