Looking for a "join-like" or "lookup-like" expression.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- json
- Ambito
- data
Direzione di ricerca
Inizia esaminando la funzione let proposta in JEP 11 e il comportamento dello scope descritto nell’issue. Confronta questa proposta con le capacità attuali delle espressioni JMESPath e determina se la ricerca richiesta, simile a una join, sia possibile senza una nuova funzionalità del linguaggio. Il lavoro è completato quando viene documentata la risposta attuale oppure viene prodotta una proposta di funzionalità con un ambito sufficientemente definito.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 2.5k
- Fork
- 231
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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.
Altre issue di jmespath/jmespath.py
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
jmespath/jmespath.py#401 ·
-
floor() and ceil() raise OverflowError / ValueError on Infinity and NaNForse già presa @guocn l’ha presa 49 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
jmespath/jmespath.py#381 ·
-
Lexer gives quoted identifiers an `end` that is the token length, not its end offsetForse già presa @chiliec l’ha presa 50 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 20/100
jmespath/jmespath.py#380 ·
-
sdist is missing `tests/__init__.py`Forse già presa @deepakganesh78 l’ha presa 127 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 38/100
jmespath/jmespath.py#341 · 1 commento ·
-
Different behavior on merge function between the JS lib and the Python libForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
jmespath/jmespath.py#329 · 1 commento ·
Tutte le issue di jmespath/jmespath.py
Issue simili
-
test_real_pandoc_failure_is_one_path_free_line fails on macOS CI with current Homebrew pandocApertabug TAG: unit tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
learningequality/ricecooker#898 ·
-
task
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
freelawproject/litigant-portal#1285 ·
I maintainer di solito rispondono entro 2 giorni
-
least_squares returns a nonfinite objective for an invalid initial residualForse già presa @sylvesterkaczmarek l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
google-deepmind/mujoco#4023 ·
I maintainer di solito rispondono entro 11 giorni
-
Five Australian birds: Red-capped Parrot, Red-winged Fairywren, Gilbert’s Honeyeater, Western Spinebill, Western WattlebirdForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
arnegiacomo/fugleramme#427 ·
I maintainer di solito rispondono entro 1 giorno
-
MONDO's zebu and cat Arnold-Chiari terms are is_a a dog disease (monarch-initiative/mondo#10939)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
NCATSTranslator/Babel#1317 ·
I maintainer di solito rispondono entro 2 giorni