Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ohmycloud/fastapi_db_pool
FastAPI 数据库连接池(Example)
https://github.com/ohmycloud/fastapi_db_pool
Last synced: 2 days ago
JSON representation
FastAPI 数据库连接池(Example)
- Host: GitHub
- URL: https://github.com/ohmycloud/fastapi_db_pool
- Owner: ohmycloud
- Created: 2024-01-19T07:06:44.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-01-22T07:37:07.000Z (10 months ago)
- Last Synced: 2024-02-18T09:26:53.849Z (9 months ago)
- Language: Python
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Fast-API with DB Connection Pools
## Problem Statement
### Some common problems with database connections
1. Database connection limit exceeded
2. Database connection timeout
3. Database connection is not closed properly
4. Database connection is not released properly创建一个 Postgres 数据库表, 包含 `id`, `fname`, `lname`, `email`, `password` 这些字段:
```sql
CREATE TABLE public.user
(
id serial PRIMARY KEY,
fname VARCHAR(50) NOT NULL,
lname VARCHAR(50) NOT NULL,
email VARCHAR(50) NOT NULL,
password VARCHAR(50) NOT NULL
);
```连接池的创建参考:https://github.com/tiangolo/fastapi/discussions/9097