ukaea / ukaea/fds

Implement NDJSON Streaming / Export Endpoints

Open
#41 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api feature performance priority: high
Dominant language
Python
Stars
0
Forks
1
Avg merge
26m
Merged PRs (30d)
24

Description

Standard list endpoints (GET /datasets) use simple limit/offset pagination which guarantees Out-Of-Memory (OOM) crashes on the server if a client attempts to pull the entire catalog (?limit=1000000). To fix this, we must enforce bounds on active endpoints and build dedicated streaming endpoints for scientific bulk-export workflows.

Acceptance Criteria:

  • Enforce a strict max_limit (e.g., 1000) on all standard list endpoints to protect the memory pool.
  • Create dedicated GET /export/{resource} endpoints.
  • Implement SQLAlchemy's yield_per() cursors coupled with FastAPI's StreamingResponse to stream the data as NDJSON (JSON-Lines), maintaining a low, constant memory footprint on the server regardless of export size.

Governing ADR(s): ADR 0020


Migrated from the internal tracker, where it was #7, opened 2026-02-25.
In progress as #14.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ADR 0020 and the existing standard list endpoints such as GET /datasets. Review how SQLAlchemy yield_per() can feed FastAPI StreamingResponse as NDJSON, while enforcing max_limit on list endpoints. Done means bounded standard lists and dedicated GET /export/{resource} endpoints with constant-memory streaming; note that the issue says this work is in progress as #14.

Written by the indexing model from the issue text.

Assessment

Tech stack
fastapi, python, sqlalchemy
Domain
api, backend, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.