Comments (13)
Is there an ETA for this?
from sqlmodel.
Any movement on this ? Thanks for great work so far
from sqlmodel.
Hi there,
@tiangolo can we help you on this transition ? What could save you some time here ?
Pydantic V2 is useful independently of SQLModel but any project with SQLModel is stuck behind.
from sqlmodel.
Is there an ETA for this?
Tiangolo has worked hard to bring FastAPI over to Pydantic v2. That's pretty far, and there he says, 4d ago, that he'll update SQLModel next. tiangolo/fastapi#9709 (reply in thread)
from sqlmodel.
FastAPI's Pydantic v2 support seems quite complete now, the CI now runs both with v1 and v2. I didn't look very closely, but all tests seem to pass.
Perhaps now is a good time to check how it would go with SQLModel and Pydantic v2. Has anyone taken a look?
There's a migration guide at https://docs.pydantic.dev/dev-v2/migration/
from sqlmodel.
I Is there a release date for sqlmodel fully compatible with latest version (>2) of pydantic ?
Is there an ETA for this?
Tiangolo has worked hard to bring FastAPI over to Pydantic v2. That's pretty far, and there he says, 4d ago, that he'll update SQLModel next. tiangolo/fastapi#9709 (reply in thread)
Not yet, but it's on his todo list
from sqlmodel.
Should this issue not be closed now that v0.0.14 is out and supports pydantic v2?
from sqlmodel.
From #654
This is a tentative roadmap, I will update it as things evolve. Some things might be discarded, others might be added later. I didn't want to make it fully public as it could raise expectations, but it seems it would be more beneficial for the community to know all the ideas and objectives.
Now, here's the current high-level tentative roadmap:
Support for the latest SQLAlchemy before 2.0.
Support for SQLAlchemy 2.0.
Support for Pydantic 2.0.
from sqlmodel.
@pmithrandir @tiangolo has fixed this and both support is now integrated in the master branch. So you can use v2 for everything now
from sqlmodel.
Some suggestions:
1, support sqlalchemy mapped_column(), Mapped or Column and lambda to avoid column object already assigned to table
2, support pydantic v2 types and network types
3, support Annotated types or more...
4, Open a new branch for pydantic v2 and sqlalchemy v2 instead of
#632
samples:
from sqlmodel import SQLModel, Field
from typing_extensions import Annotated
from typing import Optional
from pydantic import AnyUrl, UrlConstraints
from pydantic.main import BaseModel
MoveSharedUrl = Annotated[AnyUrl, UrlConstraints(max_length=512, allowed_schemes=['smb', 'ftp','file'])]
from sqlalchemy import Integer, Column, String
from sqlalchemy.orm import mapped_column
from ipaddress import IPv4Address, IPv6Address
class Sample(SQLModel, table=True):
#1,
union_str : str | None = Field( description='the name', primary_key=True)
#2,
optional_str: Optional[str] = Field( )
#3, annotated Field with default value
rateMax: Annotated[int , Field( sa_column= lambda: Column(Integer, default=-1, server_default="-1", nullable=False), ge=-1, description="")] = -1
#4, pydantic annotated AnyUrl
annotated_url: MoveSharedUrl = Field(description='the url')
union_annotated_url: MoveSharedUrl |None = Field(description='the url')
#5, python type to sqlalchemy type
source_ip: IPv4Address | IPv6Address = Field(
sa_column=mapped_column(String),
description="source IP"
)
from sqlmodel.
A pull has been made for supporting my sample: mbsantiago#1
from sqlmodel.
Maybe a silly idea, but in order to liberate the people using sqlmodel to use pydantic V2 on other part of the application, could you make the transition to use the embeded v1 present in V2 ?
That would allow dev to import pydantic V2, but to keep sqlmodel connected to pydantic V1 until it's ready.
from sqlmodel.
I Is there a release date for sqlmodel fully compatible with latest version (>2) of pydantic ?
from sqlmodel.
Related Issues (20)
- Data Integrity: Raise error on attempt to delete an object required via a Relationship HOT 8
- [Querying] negating `Model.boolean` in `where()` HOT 2
- [M2M] Query dependent incl. `link_model` fields HOT 3
- Could not refresh instance HOT 10
- SQLModel doesn't recognize Relationship between models HOT 1
- Get select with options (selectinload) using response schema HOT 2
- Dose there any better way to write timezone aware datetime field without using the SQLAlchemy ? HOT 3
- Obtaining `TypeError: Cannot pickle 'module' object` on models with many-to-many relationships HOT 2
- Order of columns in the table created does not have 'id' first, despite the order in the SQLModel. Looks like it's prioritising fields with sa_column HOT 4
- Erro ao executar uvicorn.run(...) HOT 1
- Many to many relationship between a table and itself HOT 5
- How to add current date time by default on a table declaration? HOT 13
- Add documentation about how to use the async tools (session, etc) HOT 7
- async relationship bug HOT 14
- 🚀 Roadmap HOT 28
- Internal link failed at create-db-and-table.md
- Field cannot autocompletion when its a SQLModel HOT 7
- Add an overload to the `exec` method with `_Executable` statement for update and delete statements HOT 4
- How to define table prefix name
- docs/contributing.md outdated using poetry HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlmodel.