Skip to content

Conversation

@dipendrapant
Copy link

Fixes #2266.

Summary

SequencesDataAPI.retrieve_last_row now accepts:

  • id: int | typing.Sequence[int] | None
  • external_id: str | SequenceNotStr[str] | None

Behavior:

  • Single identifier → returns SequenceRows
  • Multiple identifiers → aggregates into SequenceRowsList

Rationale

Docs and docstring say lists are supported, but the implementation only handled single values. This aligns code with docs and mirrors the list semantics used elsewhere.

Implementation notes

  • Normalize identifiers via IdentifierSequence.load(...)
  • For multiple identifiers, call /sequences/data/latest per identifier and aggregate using execute_tasks(...)
  • Keep single-identifier path unchanged
  • Updated docstring (types + return description)

Testing done

  • Unit tests added: tests/tests_unit/test_api/test_sequences_data.py
    • list of external_id → returns SequenceRowsList, 2 HTTP calls
    • single id → returns SequenceRows, 1 HTTP call
  • Local checks:
    • poetry run pytest -q tests/tests_unit -k retrieve_last_row
    • poetry run pre-commit run --all-files (ruff, ruff-format, mypy, custom checks, pydoclint) all pass

Note that the integration tests were not run locally; CI should cover these.

Backwards compatibility

  • No breaking changes: single-identifier behavior unchanged
  • Expanded accepted types only

Files changed

  • cognite/client/_api/sequences.py
  • tests/tests_unit/test_api/test_sequences_data.py

Checklist

  • Tests added/updated
  • Docstring updated (docs are generated from docstrings)

@dipendrapant dipendrapant requested review from a team as code owners October 1, 2025 11:40
@gemini-code-assist
Copy link
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discrepancy between docstring and real implementation of SequencesDataAPI.retrieve_last_row

1 participant