|
33 | 33 | ## 0. About |
34 | 34 | **FastAPI boilerplate** creates an extendable async API using FastAPI, Pydantic V2, SQLAlchemy 2.0 and PostgreSQL: |
35 | 35 | - [`FastAPI`](https://fastapi.tiangolo.com): modern Python web framework for building APIs |
36 | | -- [`Pydantic V2`](https://docs.pydantic.dev/2.4/): the most widely used data validation library for Python, rewritten in Rust [`(5x-50x faster)`](https://docs.pydantic.dev/latest/blog/pydantic-v2-alpha/) |
| 36 | +- [`Pydantic V2`](https://docs.pydantic.dev/2.4/): the most widely used data Python validation library, rewritten in Rust [`(5x-50x faster)`](https://docs.pydantic.dev/latest/blog/pydantic-v2-alpha/) |
37 | 37 | - [`SQLAlchemy 2.0`](https://docs.sqlalchemy.org/en/20/changelog/whatsnew_20.html): Python SQL toolkit and Object Relational Mapper |
38 | 38 | - [`PostgreSQL`](https://www.postgresql.org): The World's Most Advanced Open Source Relational Database |
39 | | -- [`Redis`](https://redis.io): Open source, in-memory data store used by millions as a database, cache, streaming engine, and message broker |
| 39 | +- [`Redis`](https://redis.io): Open source, in-memory data store used by millions as a cache, message broker and more. |
40 | 40 | - [`ARQ`](https://arq-docs.helpmanual.io) Job queues and RPC in python with asyncio and redis. |
41 | 41 | - [`Docker Compose`](https://docs.docker.com/compose/) With a single command, create and start all the services from your configuration. |
42 | 42 |
|
43 | 43 | ## 1. Features |
44 | | -- Fully async |
45 | | -- Pydantic V2 and SQLAlchemy 2.0 |
46 | | -- User authentication with JWT |
47 | | -- Easy redis caching |
48 | | -- Easy client-side caching |
49 | | -- ARQ integration for task queue |
50 | | -- Efficient querying (only queries what's needed) |
51 | | -- Easily extendable |
52 | | -- Flexible |
53 | | -- Easy running with docker compose |
| 44 | +- ⚡️ Fully async |
| 45 | +- 🚀 Pydantic V2 and SQLAlchemy 2.0 |
| 46 | +- 🔐 User authentication with JWT |
| 47 | +- 🏬 Easy redis caching |
| 48 | +- 👜 Easy client-side caching |
| 49 | +- 🚦 ARQ integration for task queue |
| 50 | +- ⚙️ Efficient querying (only queries what's needed) |
| 51 | +- 👮 FastAPI docs behind authentication and hidden based on the environment |
| 52 | +- 🦾 Easily extendable |
| 53 | +- 🤸♂️ Flexible |
| 54 | +- 🚚 Easy running with docker compose |
54 | 55 |
|
55 | 56 | ### 1.1 To Do |
56 | 57 | #### API |
|
64 | 65 | #### Features |
65 | 66 | - [ ] Add a Rate Limiter decorator |
66 | 67 | - [ ] Add mongoDB support |
67 | | -- [ ] Add support in schema_to_select for dict as well as Pydantic Schema |
68 | | - |
69 | | -#### Security |
70 | | -- [x] FastAPI docs behind authentication and hidden based on the environment |
71 | | - |
72 | | -#### Structure |
73 | | -- [x] Remove python-decouple in favor of starlette.config |
| 68 | +- [x] Add support in schema_to_select for a list of column names |
74 | 69 |
|
75 | 70 | #### Tests |
76 | 71 | - [ ] Add Ruff linter |
@@ -634,7 +629,7 @@ crud_users.db_delete(db=db, username="myusername") |
634 | 629 | ``` |
635 | 630 |
|
636 | 631 | #### More Efficient Selecting |
637 | | -For the `get` and `get_multi` methods we have the option to define a `schema_to_select` attribute, which is what actually makes the queries more efficient. When you pass a pydantic schema in `schema_to_select` to the `get` or `get_multi` methods, only the attributes in the schema will be selected. |
| 632 | +For the `get` and `get_multi` methods we have the option to define a `schema_to_select` attribute, which is what actually makes the queries more efficient. When you pass a `pydantic schema` (preferred) or a list of the names of the attributes in `schema_to_select` to the `get` or `get_multi` methods, only the attributes in the schema will be selected. |
638 | 633 | ```python |
639 | 634 | from app.schemas.user import UserRead |
640 | 635 | # Here it's selecting all of the user's data |
|
0 commit comments