Looking for a "join-like" or "lookup-like" expression.
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 20/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- json
- Área
- data
Línea de trabajo
Comienza revisando la función let propuesta en JEP 11 y el comportamiento de ámbito descrito en el issue. Compara esa propuesta con las capacidades actuales de las expresiones JMESPath y determina si la búsqueda solicitada, similar a un join, es posible sin una nueva funcionalidad del lenguaje. Se considera terminado documentar la respuesta actual o elaborar una propuesta de funcionalidad con un alcance suficientemente definido.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hello,
First and foremost, thanks in advance for sharing JMESPath which I find very elegant and powerful.
I have recently been faced with a challenge for which I could not build a single JMESPath expression that solves it for me. Consider the case of a JSON document like:
{
"things": [{
"id": 1,
"name": "Thing #1",
"owner_id": 1
}, {
"id": 2,
"name": "Thing #2",
"owner_id": 2
}, {
"id": 3,
"name": "Thing #3",
"owner_id": 1
}],
"users": [{
"id": 1,
"name": "User #1"
}, {
"id": 2,
"name": "User #2"
}]
}
The objective would be to return a the list of things where each owner_id wold be "resolved", so to speak, from the entries in the users array. To put it In SQL-ish terms, I'm looking to join things and users on things[*].owner_id and users[*].id.
After trying multiple things, the best and cleanest (albeit non-working!) solution I came up with was something like:
things[*].{id: id, owner_id:owner_id, owner:users[?id == owner_id]}
Unfortunatelly, within the multiselect hash, the expression for owner can't resolve users. It's clearly a matter of scope. Having investigated furter, I found out about JEP 11 https://github.com/jmespath/jmespath.site/pull/6 and it seems like the let function could be a possible solution.
Facts:
- I could create a custom function to handle my particular need.
- With JEP 11 in place, I could build an expression to solve this particular challenge.
Other than those two options, am I missing something that could be used currently?
Thanks in advance.
Regards.
- Lenguaje dominante
- Python
- Estrellas
- 2.5k
- Forks
- 231
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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.
Más de jmespath/jmespath.py
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
jmespath/jmespath.py#401 ·
-
floor() and ceil() raise OverflowError / ValueError on Infinity and NaNPosiblemente ocupada @guocn la tomó hace 48 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
jmespath/jmespath.py#381 ·
-
Lexer gives quoted identifiers an `end` that is the token length, not its end offsetPosiblemente ocupada @chiliec la tomó hace 50 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 20/100
jmespath/jmespath.py#380 ·
-
sdist is missing `tests/__init__.py`Posiblemente ocupada @deepakganesh78 la tomó hace 127 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 38/100
jmespath/jmespath.py#341 · 1 comentario ·
-
Different behavior on merge function between the JS lib and the Python libQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
jmespath/jmespath.py#329 · 1 comentario ·
Todos los issues de jmespath/jmespath.py
Issues similares
-
test_real_pandoc_failure_is_one_path_free_line fails on macOS CI with current Homebrew pandocAbiertobug TAG: unit tests
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
learningequality/ricecooker#898 ·
-
task
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
freelawproject/litigant-portal#1285 ·
Los mantenedores suelen responder en 2 días
-
least_squares returns a nonfinite objective for an invalid initial residualPosiblemente ocupada @sylvesterkaczmarek la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
google-deepmind/mujoco#4023 ·
Los mantenedores suelen responder en 11 días
-
Five Australian birds: Red-capped Parrot, Red-winged Fairywren, Gilbert’s Honeyeater, Western Spinebill, Western WattlebirdPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
arnegiacomo/fugleramme#427 ·
Los mantenedores suelen responder en 1 día
-
MONDO's zebu and cat Arnold-Chiari terms are is_a a dog disease (monarch-initiative/mondo#10939)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
NCATSTranslator/Babel#1317 ·
Los mantenedores suelen responder en 2 días