difference between ormdantic and sqlmodel? #25
-
Great! but could you show the key difference between this library and |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
This should probably be a discussion instead, but I'll give it a try (disclaimer: I have not spent too much time reading through both code bases, so this is not very detailed and I might be wrong in some aspects). These are the main differences I can see after a brief study:
|
Beta Was this translation helpful? Give feedback.
-
Well, Thank you @iron3oxide for the Amazing explanation for both I will add a few things for you @0xsirsaif , is ormdantic similar to PonyORM a (Pure python queries) and that's mean the ability to write queries to the database using Python generator expressions and lambdas, Its make the close structure to writing SQL Queries but making it more easy and easy for new people to integrate it!. |
Beta Was this translation helpful? Give feedback.
-
Hey @iron3oxide I add your Comment to the docs, cause I find it more clear and more good comparison between the two packages! https://ormdantic.yezz.me/faq/#difference-between-ormdantic-and-sqlmodel Thank you so much 🙇🏻♂️ |
Beta Was this translation helpful? Give feedback.
This should probably be a discussion instead, but I'll give it a try (disclaimer: I have not spent too much time reading through both code bases, so this is not very detailed and I might be wrong in some aspects). These are the main differences I can see after a brief study:
ormdantic
uses a wrapper/decorator to make pydantic BaseModels behave like database tables as well, whereassqlmodel
inherits from pydantic BaseModel and uses a modified SQLAlchemy base model as its metaclass to achieve the same thing.In
sqlmodel
, the database connection is not built into the main class (SQLModel), but handled by separate equivalents of SQLAlchemy classes and functions (Session and create_engine).…