Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filters excludes values if model name doesn't exists in filter_or #77

Open
MathiasCClausen opened this issue Mar 25, 2022 · 0 comments
Open

Comments

@MathiasCClausen
Copy link

MathiasCClausen commented Mar 25, 2022

I have an issue, where my datamodel, sometimes have a relation to another table, and sometimes it is None. I use sqlalchemy-filters to search for items in a table, however when I add filter_or for a relation where the model name doesn't exists, all the items are excluded.

Is there any way I can avoid this behaviour? When i include some columns that only exists for some items/rows, even if try to search for another column, the items disappear because the column is included in the filter_or

In the below example, ProjectReference only exists for som items, where as other items have a relation to another table

filter_or=[
{"model": "ProjectReference", "field": "project_reference_name", "op": "ilike", "value": "%12345%"},
{"model": "SupplierPart", "field": "supplier_part_description", "op": "ilike", "value": "%12345%"},
{"model": "SupplierPart", "field": "part_inwatec_id", "op": "ilike", "value": "%12345%"},
{"model": "SupplierPart", "field": "supplier_part_id", "op": "ilike", "value": "%12345%"},
{"model": "Supplier", "field": "name", "op": "ilike", "value": "%12345%"}]

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

No branches or pull requests

1 participant