Skip to content

/roles/capability-sets endpoint has totalRecords first in response json #52

@brycekbargar

Description

@brycekbargar

LDLite has always assumed the first key in the response json is the list of records. This has worked so far but JSON order isn't guaranteed. The /roles/capability-sets is one such endpoint that breaks with the current implementation.

Cell In[18], line 1
----> 1 _ = ld.query(table="roles-capability-sets", path="/roles/capability-sets")
File ~/ldlite_2/.venv/lib/python3.14/site-packages/ldlite/__init__.py:403, in LDLite.query(self, table, path, query, json_depth, limit, transform, keep_raw)
    400     processed = next(p_count)
    401     return limit is None or processed < limit
--> [403](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/aneslin/ldlite_2/~/ldlite_2/.venv/lib/python3.14/site-packages/ldlite/__init__.py:403) self._db.ingest_records(
    404     prefix,
    405     on_processed_limit if limit is not None else on_processed,
    406     records,
    407 )
    408 pbar.close()
    410 self._db.drop_extracted_tables(prefix)
File ~/ldlite_2/.venv/lib/python3.14/site-packages/ldlite/_sqlx.py:83, in DBTypeDatabase.ingest_records(self, prefix, on_processed, records)
     76 def ingest_records(
     77     self,
     78     prefix: Prefix,
     79     on_processed: Callable[[], bool],
     80     records: Iterator[tuple[int, bytes]],
     81 ) -> None:
     82     if self._dbtype != DBType.POSTGRES:
---> [83](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/aneslin/ldlite_2/~/ldlite_2/.venv/lib/python3.14/site-packages/ldlite/_sqlx.py:83)         super().ingest_records(prefix, on_processed, records)
...
    100 )
    102 last_id: str | None = None
    103 page = count(start=1)
TypeError: 'int' object is not subscriptable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions