# What is an ORM

* A layer of abstraction that sits between the database and us
* We can perform all database operations though traditional Python code
* No longer requires SQL

![](https://3885248957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoE4wMO1dMVDOGDjh0En7%2Fuploads%2FGEsNZdGZITuEs0CoE5Sp%2Fimage.png?alt=media\&token=98513a6d-6d92-4a96-a63f-316073bb1426)

### What do ORMs do?

* Instead of manually defining tables in Postgres, we can define our table as python models

![](https://3885248957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoE4wMO1dMVDOGDjh0En7%2Fuploads%2FNRDhQwlfVl3dJD0e9Veq%2Fimage.png?alt=media\&token=1ec8b892-ddf9-4e64-a351-7b0a1e25be29)

* Queries can be made exclusively through python code
* No SQL is necessary

![](https://3885248957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoE4wMO1dMVDOGDjh0En7%2Fuploads%2FgDqYkdlYbn99L28O8Zb8%2Fimage.png?alt=media\&token=4b6fc2f6-5075-436b-a972-bed25de51f8f)

### SQLAlchemy

[Official Documentation](https://www.sqlalchemy.org/)

[FastAPI ORM Setup Documentation](https://fastapi.tiangolo.com/tutorial/sql-databases/?h=)

* Is one of the most popular python ORMs
* Is a standalone library and has no association with FastAPI
* It can be used with any other python web framework or any python based application
