Upgrade django-cte from 1.3.3 to 5.x
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 30/100
Hướng nghiên cứu
Read the django-cte 2.x+ usage guide and the listed call sites, starting with contentcuration/db/models/query.py and contentcuration/db/models/manager.py; review the closed bump in #6435 for its failing tests. After the Django 4.2 upgrade, migrate the imports and CTE API, then run pytest and add coverage for the WithValues/RIGHT_JOIN query and each _join_type=LOUTER call site, confirming they return the same rows.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
Dependabot PR #6435 bumped django-cte from 1.3.3 to 5.0.1. That PR was closed because every release from 2.0.0 on supports only Django 4.2 to 6.1, and Studio pins django==3.2.24. This upgrade waits on the Django 4.2 upgrade. Once Django is upgraded, the bump also needs Studio's CTE code moved to the 2.x+ API.
Complexity: Medium
Target branch: unstable
Context
- On Django 3.2, the Python tests in #6435 fail with:
TypeError: Query.get_compiler() got an unexpected keyword argument 'elide_empty' - In 5.0.1,
django_cte/query.pycallscte.query.get_compiler(connection=..., elide_empty=...)unconditionally. - Studio's
WithValuesQuery.get_compiler(self, using=None, connection=None)incontentcuration/db/models/query.pydoes not acceptelide_empty, so it fails with that error even on Django 4.2. contentcuration/db/models/query.pysubclassesdjango_cte.Withto addRIGHT JOIN(With,WithValues).CustomTreeQuerySetandCustomManager(db/models/manager.py) build onCTEQuerySet.- Code that imports
With,CTEQuerySetorCTEManagerfromdjango_cte(all deprecated in 2.0.0, whereWithbecameCTEandwith_ctebecame a standalone function):contentcuration/models.pycontentcuration/db/models/query.py,db/models/manager.pycontentcuration/node_metadata/cte.pycontentcuration/utils/recommendations.py,utils/csv_writer.pycontentcuration/views/base.py,views/nodes.pycontentcuration/viewsets/channel.py,viewsets/contentnode.py,viewsets/sync/endpoint.pymanagement/commands/fix_missing_import_sources.py,management/commands/mark_incomplete.pykolibri_public/management/commands/rectify_incorrect_contentnode_source_fields.py
- On Django ≥ 5.2 two more changes apply: in 3.0.0,
_join_type=LOUTERjoins that pull in a related table become LEFT OUTER instead of INNER (used inmark_incomplete.py,node_metadata/cte.py,utils/csv_writer.py), and in 2.0.0,.values()names must match thecte.colreferences. - Studio passes no
materialized=argument, so the 5.0.0NOT MATERIALIZEDchange does not apply. - django-cte 4.0.0 requires Python ≥ 3.10, which Studio's CI already uses.
The Change
- Studio should run on django-cte 5.x with no deprecated django-cte API left in its code.
- The custom
RIGHT JOINandVALUESCTEs should keep producing the same SQL results on the new API. - The bump and the call-site migration should land in one PR.
Acceptance Criteria
-
requirements.inandrequirements.txtpin django-cte 5.x. - No module imports
With,CTEQuerySetorCTEManagerfromdjango_cte. -
pytestpasses with no django-cte deprecation warnings. - The tag
WithValues/RIGHT_JOINquery inviewsets/contentnode.pyreturns the same rows as before the upgrade, and a test covers it. - On the Django version Studio runs, each
_join_type=LOUTERcall site keeps the same rows it returned before the upgrade, and a test covers each one.
References
- django-cte changelog: https://github.com/dimagi/django-cte/blob/main/CHANGELOG.md
- django-cte 2.x+ usage:
https://dimagi.github.io/django-cte/ - Closed bump: #6435
AI usage
rtibblesbot (Claude Code) reviewed #6435, read django-cte's source at v1.3.3, v2.0.0 and v5.0.1, and drafted this issue.
Filed from #6435's review.
- Ngôn ngữ chính
- JavaScript
- Star
- 214
- Fork
- 327
- Merge trung bình
- 17 giờ 5 phút
- Pull request đã merge (30 ngày)
- 25
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không 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 learningequality/studio
-
Community library status changes don't update `date_updated`Có thể đã có người làm @ArpitaSamanta10 đã nhận 14 ngày trước. Đang mởcommunity-contribution-in-progress DEV: backend good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
learningequality/studio#6414 · 8 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Activation key can activate a different account whose email differs only in caseCó thể đã có người làm @Madhu-priya123 đã nhận 5 ngày trước. Đang mởDEV: backend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
learningequality/studio#6410 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DEV: backend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
learningequality/studio#6409 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DEV: backend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
learningequality/studio#6407 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Stripe webhook accepts events when no webhook secret is configuredCó thể đã có người làm @adibmbrk đã nhận 14 ngày trước. Đang mởcommunity-contribution-in-progress DEV: backend good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
learningequality/studio#6404 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của learningequality/studio
Issue tương tự
-
Mend: dependency security vulnerability
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
ManageIQ/manageiq-ui-service#2259 ·
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 73/100
electerious/Ackee#411 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[bug] 提瓦特记事本原石检测框宽度较窄Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
babalae/bettergi-scripts-list#3905 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] "Configure Colota" opens Colota with "Invalid configuration: No configuration data in URL"Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 87/100
dedicatedcode/reitti#1445 ·
Maintainer thường phản hồi trong vòng 1 ngày