Skip to content

Conversation

Erich-e
Copy link

@Erich-e Erich-e commented Sep 24, 2021

Hi, and thank you for this project

I tried running this sample shortcut relationship filter against the example api, but I ran into a problem that looks like
GET /persons?filter=[{"name":"computers__serial","op":"ilike","val":"%Amstrad%"}] HTTP/1.1

127.0.0.1 - - [24/Sep/2021 00:18:58] "GET /persons?filter=%5B%7B%22name%22%3A+%22computers__serial%22%2C+%22op%22%3A+%22ilike%22%2C+%22val%22%3A+%22%25Amstrad%25%22%7D%5D HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/Users/erich/.pyenv/versions/3.9.4/envs/frj/lib/python3.9/site-packages/flask/app.py", line 2088, in __call__
    return self.wsgi_app(environ, start_response)
 . . . 
  File "/Users/erich/.pyenv/versions/3.9.4/envs/frj/lib/python3.9/site-packages/flask_rest_jsonapi/data_layers/filtering/alchemy.py", line 20, in create_filters
    filters.append(Node(model, filter_, resource, resource.schema).resolve())
  File "/Users/erich/.pyenv/versions/3.9.4/envs/frj/lib/python3.9/site-packages/flask_rest_jsonapi/data_layers/filtering/alchemy.py", line 53, in resolve
    return getattr(self.column, self.operator)(**value)
TypeError: ilike() got an unexpected keyword argument 'serial'

It looks like this is because the filter ultimately is becoming Computer.ilike(serial="%Amstrad%"). So this is to update the example to a filter that becomes Computer.any(serial="Amstrad")

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.

1 participant