Chaining FilterExpressions
Aperta
@phanak-sap ci sta già lavorando.
Dal 20/9/2024.
bug
- Lingua principale
- Python
- Stelle
- 268
- Fork
- 100
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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!
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.