Table of Contents
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.
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
pyenv install 3.12 && pyenv local 3.12
poetry install
Hope you enjoy it.
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!
- GeoAlchemy 2 provides extensions to SQLAlchemy for working with spatial databases.
- PostGIS is a spatial database extender for PostgreSQL object-relational database.
- geojson_pydantic provides a suite of Pydantic models matching the GeoJSON specification rfc7946.
- [long time ago...] it was a long time ago in galaxy far far away...
- [2024-09-29] unit tests added