Adding a custom Prefetch to a cloned queryset mutates the original query
Maintainer thường phản hồi trong vòng 4 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
The repro imports Prefetch from tortoise.query_utils and calls prefetch_related. Read the prefetch_related implementation and the queryset clone logic. Run the snippet to confirm second_parent leaks into original. Done when original queryset remains unchanged; PR #2373 is open.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Here Child.parent is a foreign key to Parent. On current develop, a queryset clone shares the lists of custom prefetch queries with the original. Adding another Prefetch for the same relation changes both queries.
from tortoise.query_utils import Prefetch
original = Child.all().prefetch_related(
Prefetch("parent", Parent.all(), to_attr="first_parent")
)
derived = original.prefetch_related(
Prefetch("parent", Parent.all(), to_attr="second_parent")
)
row = await original.first()
When a child exists, row also has second_parent even though it was only requested on derived. The original queryset should remain unchanged.
- Ngôn ngữ chính
- Python
- Star
- 5.6k
- Fork
- 543
- Merge trung bình
- 4 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 31
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tortoise/tortoise-orm
-
Automatic DatetimeField values bypass custom validatorsCó thể đã có người làm @IlyaKhalafi đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
tortoise/tortoise-orm#2409 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
tortoise/tortoise-orm#668 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
UUIDField skips configured validators when writing valuesCó thể đã có người làm @IlyaKhalafi đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
tortoise/tortoise-orm#2407 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
tortoise/tortoise-orm#2406 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
TimeField skips validators for timedelta valuesCó thể đã có người làm @IlyaKhalafi đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
tortoise/tortoise-orm#2404 ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của tortoise/tortoise-orm
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
adafruit/Fruit-Jam-OS#98 ·
-
python triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/semantic-kernel#14753 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
area:cli area:configuration documentation priority:low size:small
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 80/100
RonaldHensbergen/composable-data-stack#1222 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug python
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
pvlib/pvlib-python#2939 ·
Maintainer thường phản hồi trong vòng 1 ngày