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

Aperta
#2,579 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Documentazione
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
django, postgresql, python

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
65
Fork
28
Merge medio
4g 7h
PR unite (30g)
25

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenEnergyPlatform/oeplatform

Tutte le issue di OpenEnergyPlatform/oeplatform

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.