ragflow/api/db
lgphone 7f80d7304d
Fix: Optimized the get_by_id method to resolve the issue of missing exceptions and improve query performance (#6320)
Fix: Optimized the get_by_id method to resolve the issue of missing
exceptions and improve query performance

### What problem does this PR solve?

Optimized the get_by_id method to resolve the issue of missing
exceptions and improve query performance.
Optimization details:
1. The original method used a custom query method that required
concatenating SQL, which impacted performance.
2. The query method returned a list, which needed to be accessed by
index, posing a risk of index out-of-bounds errors.
3. The original method used except Exception to catch all errors, which
is not a best practice in Python programming and may lead to missing
exceptions. The get_or_none method accurately catches DoesNotExist
errors while allowing other errors to be raised normally.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [x] Performance Improvement
2025-03-20 23:23:48 +08:00
..
services Fix: Optimized the get_by_id method to resolve the issue of missing exceptions and improve query performance (#6320) 2025-03-20 23:23:48 +08:00
__init__.py Tagging (#4426) 2025-01-09 17:07:21 +08:00
db_models.py Feat: add agent share team viewer (#6222) 2025-03-19 19:04:13 +08:00
db_utils.py Introduced beartype (#3460) 2024-11-18 17:38:17 +08:00
init_data.py Fix: empty doc id validation. (#6064) 2025-03-14 11:45:44 +08:00
reload_config_base.py Format file format from Windows/dos to Unix (#1949) 2024-08-15 09:17:36 +08:00
runtime_config.py Update version display on web UI (#3405) 2024-11-14 17:51:21 +08:00