# Pydantic Model vs SQLAlchemy Model

### Pydantic Model

* Schema/Pydantic Models define the structure of a request & response
* This ensures that when a user wants to create a post, the request will only go through if has a "title" and "content" in the body (as defined via Pydantic)&#x20;

![](https://3885248957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoE4wMO1dMVDOGDjh0En7%2Fuploads%2FV9rIiQkt4xADnQNrtwzi%2Fimage.png?alt=media\&token=3442e207-ffc3-4ff2-85f0-c2a8330c6040)

### SQLAlchemy Model

* Responsible for defining the columns of our "posts" table within Postgres
* Is used to query, create, delete, update entries within the database

![](https://3885248957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoE4wMO1dMVDOGDjh0En7%2Fuploads%2F4rVlA3vG2FOLKs7UefKp%2Fimage.png?alt=media\&token=d51b59bd-099c-474b-b988-490581d576d4)
