Bulk Upload: tables with foreign keys must be uploaded in dependency order, and nothing says so

Đang mở
#2,579 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 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
35/100
Loại issue
Tài liệu
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Sôi nổi
Công nghệ
django, postgresql, python
Lĩnh vực
api, database, documentation

Hướng nghiên cứu

Start with the Bulk Upload documentation and API reference, and review related issue #2362 to determine whether the project wants documentation or pre-streaming validation. Done should either explain parent-first dependency order and unsupported mutual references, or specify a clear 400 response naming referenced tables.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

API type: enhancement :gear:

A Bulk Upload loads a CSV into one table with COPY. If that table has a foreign key to another table, every referenced row must already exist, otherwise the whole upload fails and is rolled back. So a set of related tables can only be uploaded one table at a time, in dependency order (parents first), and two tables that reference each other cannot be bulk-uploaded at all. Raised in a comment on #2362 (2026-07-06).

Nothing tells a user this today: the error is the foreign-key violation from Postgres, at the end of a possibly long upload.

Options:

  • Document it in the Bulk Upload docs and the API reference: upload in dependency order. Cheapest, and covers the common case.
  • Check before streaming: look up the table's foreign keys and answer with a clear 400 that names the referenced table(s), before the body is consumed. That needs no data check, only the catalog.
  • Deferred constraints: if the foreign keys were created DEFERRABLE, the upload transaction could SET CONSTRAINTS ALL DEFERRED. That only helps within one transaction, so it would not by itself solve uploads of several tables, which arrive as separate requests.

Related: #2362.

Ngôn ngữ chính
Python
Star
65
Fork
28
Merge trung bình
4 ngày 7 giờ
Pull request đã merge (30 ngày)
25

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của OpenEnergyPlatform/oeplatform

Tất cả issue của OpenEnergyPlatform/oeplatform

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.