Skip to content

Integration of FastAPI framework supported by Pydantic with SQLAlchemy ORM and PostGIS on psycopg driver

License

Notifications You must be signed in to change notification settings

grillazz/fastapi-postgis

Repository files navigation

fastapi-postgis

Contributors Forks Stargazers Issues MIT License LinkedIn

fastapi-postgis

Table of Contents
  1. About The Project
  2. Getting Started
  3. Acknowledgments

About The Project

This example demonstrates the seamless integration of FastAPI, a modern, high-performance web framework, with Pydantic 2.0, a robust and powerful data validation library. The integration is further enhanced by the use of SQLAlchemy ORM, a popular and feature-rich Object-Relational Mapping tool, and PostGIS16, a spatial database extender for PostgreSQL that enables efficient storage, indexing, and querying of geospatial data.

The entire stack is connected using the psycopg Database Client Library, which provides a robust and efficient way to interact with PostgreSQL databases in Python, leveraging the power of asyncio and event loops.

Notably, this example showcases the latest and greatest versions of SQLAlchemy and psycopg, which are renowned for their robustness, power, and speed. The inclusion of FastAPI adds a modern, fast, and high-performance web framework to the mix allowing for the rapid development of APIs with Python 3.8+.

FastAPI has received significant recognition in the industry, including a review on thoughtworks Technology Radar in April 2021, where it was classified as a Trial technology, with comments praising its performance, ease of use, and features such as API documentation using OpenAPI. Additionally, FastAPI was recognized in the Python Developers Survey 2022 Results, conducted by the Python Software Foundation and JetBrains, where it was reported that 1 in 4 Python developers use FastAPI, with a 4 percentage point increase from the previous year.

Built With

FastAPI Pydantic SQLAlchemy Uvicorn pytest psycopg alembic rich

(back to top)

Getting Started

Make will help you

To build , run and test and more ... use magic of make help to play with this project.

1. make docker-build
2. make docker-up
3. make docker-alembic-migrate

(back to top)

Local development with poetry

pyenv install 3.12 && pyenv local 3.12
poetry install

Hope you enjoy it.

Acknowledgments

Use this space to list resources you find helpful and would like to give credit to. I've included a few of my favorites to kick things off!

(back to top)

Change Log

  • [long time ago...] it was a long time ago in galaxy far far away...
  • [2024-09-29] unit tests added

(back to top)

About

Integration of FastAPI framework supported by Pydantic with SQLAlchemy ORM and PostGIS on psycopg driver

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published