Chaining FilterExpressions
Abierto
@phanak-sap ya está trabajando en esto.
Desde el 20/9/2024.
bug
- Lenguaje dominante
- Python
- Estrellas
- 268
- Forks
- 100
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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!
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Evaluación
Este issue todavía no se ha evaluado.