API Call organization_list returns 'Internal Server Error' in CKAN 2.10
rickelt opened this issue · comments
CKAN version
2.10.x
Installed with the official ckan-docker Repo
Describe the bug
The API call /api/3/action/organization_list?all_fields=true&organizations=myorga
returns an Internal Server Error as response.
Steps to reproduce
Use the API call with the above mentioned parameters: /api/3/action/organization_list?all_fields=true&organizations=myorga
Expected behavior
As response it should return a list of all organizations, with all fields shown, where the name of the organization is 'myorga' (in this case).
Additional details
If I only use the call /api/3/action/organization_list?all_fields=true
it works just fine.
Here is the Error Stack:
ckan-1 | 2024-05-02T13:40:46.033771229Z 2024-05-02 13:40:46,033 INFO [ckan.config.middleware.flask_app] 302 / render time 0.002 seconds
ckan-1 | 2024-05-02T13:40:55.360881214Z 2024-05-02 13:40:55,348 ERROR [ckan.views.api] IN expression list, SELECT construct, or bound parameter object expected, got 'myorga'.
ckan-1 | 2024-05-02T13:40:55.360914827Z Traceback (most recent call last):
ckan-1 | 2024-05-02T13:40:55.360916712Z File "/srv/app/src/ckan/ckan/config/middleware/../../views/api.py", line 283, in action
ckan-1 | 2024-05-02T13:40:55.360925517Z result = function(context, request_data)
ckan-1 | 2024-05-02T13:40:55.360926645Z File "/srv/app/src/ckan/ckan/logic/__init__.py", line 580, in wrapped
ckan-1 | 2024-05-02T13:40:55.360927889Z result = _action(context, data_dict, **kw)
ckan-1 | 2024-05-02T13:40:55.360928829Z File "/srv/app/src/ckan/ckan/logic/action/get.py", line 561, in organization_list
ckan-1 | 2024-05-02T13:40:55.360929832Z return _group_or_org_list(context, data_dict, is_org=True)
ckan-1 | 2024-05-02T13:40:55.360930743Z File "/srv/app/src/ckan/ckan/logic/action/get.py", line 396, in _group_or_org_list
ckan-1 | 2024-05-02T13:40:55.360931691Z query = query.filter(model.Group.name.in_(groups)) # type: ignore
ckan-1 | 2024-05-02T13:40:55.360932611Z File "/usr/lib/python3.10/site-packages/sqlalchemy/sql/operators.py", line 620, in in_
ckan-1 | 2024-05-02T13:40:55.360933580Z return self.operate(in_op, other)
ckan-1 | 2024-05-02T13:40:55.360934526Z File "/usr/lib/python3.10/site-packages/sqlalchemy/orm/attributes.py", line 317, in operate
ckan-1 | 2024-05-02T13:40:55.360935512Z return op(self.comparator, *other, **kwargs)
ckan-1 | 2024-05-02T13:40:55.360936422Z File "/usr/lib/python3.10/site-packages/sqlalchemy/sql/operators.py", line 1402, in in_op
ckan-1 | 2024-05-02T13:40:55.360937372Z return a.in_(b)
ckan-1 | 2024-05-02T13:40:55.360938270Z File "/usr/lib/python3.10/site-packages/sqlalchemy/sql/operators.py", line 620, in in_
ckan-1 | 2024-05-02T13:40:55.360939249Z return self.operate(in_op, other)
ckan-1 | 2024-05-02T13:40:55.360940159Z File "/usr/lib/python3.10/site-packages/sqlalchemy/orm/properties.py", line 423, in operate
ckan-1 | 2024-05-02T13:40:55.360941130Z return op(self.__clause_element__(), *other, **kwargs)
ckan-1 | 2024-05-02T13:40:55.360942030Z File "/usr/lib/python3.10/site-packages/sqlalchemy/sql/operators.py", line 1402, in in_op
ckan-1 | 2024-05-02T13:40:55.360943026Z return a.in_(b)
ckan-1 | 2024-05-02T13:40:55.360943890Z File "/usr/lib/python3.10/site-packages/sqlalchemy/sql/operators.py", line 620, in in_
ckan-1 | 2024-05-02T13:40:55.360944845Z return self.operate(in_op, other)
ckan-1 | 2024-05-02T13:40:55.360945718Z File "/usr/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 869, in operate
ckan-1 | 2024-05-02T13:40:55.360946659Z return op(self.comparator, *other, **kwargs)
ckan-1 | 2024-05-02T13:40:55.360947523Z File "/usr/lib/python3.10/site-packages/sqlalchemy/sql/operators.py", line 1402, in in_op
ckan-1 | 2024-05-02T13:40:55.360948473Z return a.in_(b)
ckan-1 | 2024-05-02T13:40:55.360949374Z File "/usr/lib/python3.10/site-packages/sqlalchemy/sql/operators.py", line 620, in in_
ckan-1 | 2024-05-02T13:40:55.360950384Z return self.operate(in_op, other)
ckan-1 | 2024-05-02T13:40:55.360952157Z File "/usr/lib/python3.10/site-packages/sqlalchemy/sql/type_api.py", line 77, in operate
ckan-1 | 2024-05-02T13:40:55.360953163Z return o[0](self.expr, op, *(other + o[1:]), **kwargs)
ckan-1 | 2024-05-02T13:40:55.360954064Z File "/usr/lib/python3.10/site-packages/sqlalchemy/sql/default_comparator.py", line 159, in _in_impl
ckan-1 | 2024-05-02T13:40:55.360956719Z seq_or_selectable = coercions.expect(
ckan-1 | 2024-05-02T13:40:55.360957690Z File "/usr/lib/python3.10/site-packages/sqlalchemy/sql/coercions.py", line 188, in expect
ckan-1 | 2024-05-02T13:40:55.360958683Z resolved = impl._literal_coercion(
ckan-1 | 2024-05-02T13:40:55.360959568Z File "/usr/lib/python3.10/site-packages/sqlalchemy/sql/coercions.py", line 589, in _literal_coercion
ckan-1 | 2024-05-02T13:40:55.360960552Z self._raise_for_expected(element, **kw)
ckan-1 | 2024-05-02T13:40:55.360961422Z File "/usr/lib/python3.10/site-packages/sqlalchemy/sql/coercions.py", line 283, in _raise_for_expected
ckan-1 | 2024-05-02T13:40:55.360962379Z util.raise_(exc.ArgumentError(msg, code=code), replace_context=err)
ckan-1 | 2024-05-02T13:40:55.360963306Z File "/usr/lib/python3.10/site-packages/sqlalchemy/util/compat.py", line 208, in raise_
ckan-1 | 2024-05-02T13:40:55.360964262Z raise exception
ckan-1 | 2024-05-02T13:40:55.360965123Z sqlalchemy.exc.ArgumentError: IN expression list, SELECT construct, or bound parameter object expected, got 'myorga'.
ckan-1 | 2024-05-02T13:40:55.361365174Z 2024-05-02 13:40:55,361 INFO [ckan.config.middleware.flask_app] 500 /api/3/action/organization_list render time 0.028 seconds