Chaining FilterExpressions
@phanak-sap is already working on this.
Since Sep 20, 2024.
Assessment
This issue has not been assessed yet.
Description
Hello,
Trying to follow this PR: https://github.com/SAP/python-pyodata/pull/113
love this change, very good implementation but am having some problems chaining AND and OR operators together.
item = {
"id": 1,
"name": 'item name',
"description": "foo-bar",
"city": "1000",
}
# Query should look like this:
term="foo" # search by string term on two fields - OR on name and description
city=1000 # AND search only those with city = 1000
get_entities().filter(Q(name__contains="foo") | Q(description__contains="foo"), city="1000")
# It does this:
{'$filter': ["city eq '1000' and (substringof('foo', name) eq true) or (substringof('foo', description) eq true)"]}
But it needs another ( ) around substring filters to fetch correct items.
Is this possible using these filters?
Many thanks!
- Dominant language
- Python
- Stars
- 268
- Forks
- 100
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SAP/python-pyodata
-
chore
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
SAP/python-pyodata#304 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
SAP/python-pyodata#108 ·
-
chore
SAP/python-pyodata#302 · 1 assignee ·
-
question
SAP/python-pyodata#294 · 1 comment · 1 assignee ·
-
bug
SAP/python-pyodata#282 · 2 comments · 1 assignee ·
All issues in SAP/python-pyodata
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
learningequality/ricecooker#747 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
run-llama/llama_index#23199 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
KhronosGroup/glTF-Blender-IO#2769 ·