Skip to content

Adding 3 new API endpoints to make easy to get the list of catalogs#97

Open
erdoganfurkan wants to merge 2 commits into
SciQLop:mainfrom
erdoganfurkan:missing_rest_api
Open

Adding 3 new API endpoints to make easy to get the list of catalogs#97
erdoganfurkan wants to merge 2 commits into
SciQLop:mainfrom
erdoganfurkan:missing_rest_api

Conversation

@erdoganfurkan

Copy link
Copy Markdown

No description provided.

@brenard-irap

Copy link
Copy Markdown

I think the error reported by MyPy, which is causing the tests to fail, is due to the fact that the type of "rooms" is not sufficiently specified.

The following errors are reported:

src/cocat/app/app.py:164: error: "Column[Any]" has no attribute "__iter__"; maybe "__str__"? (not iterable)  [attr-defined]
src/cocat/app/app.py:189: error: "Column[Any]" has no attribute "__iter__"; maybe "__str__"? (not iterable)  [attr-defined]

This occurs when iterating over the SQLAlchemy JSON column "user.rooms".

Since Column is not iterable, MyPy rightfully raises an error-even though at runtime the field contains a list (from JSON).

The fix (fix_type.patch) is to use SQLAlchemy 2.0's typing system with Mapped[...] and mapped_column(...), so that MyPy understands the actual Python type.

I tested it on my side and all the tests seem to pass with this patch.

What do you think, @jeandet?

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.

2 participants