0xPlaygrounds / 0xPlaygrounds/subgrounds

Immediate single entity query

Offen
#5 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Python
Sterne
73
Forks
12
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

**Is your feature request related to a problem? Please describe.**
Subgrounds should allow developers to query a single entity from an id. The query (and returned object) should only have scalar, non-list values.

For nested fields returning non-scalar (i.e.: other entities) or list values, they should be queried at read time.

**Describe the solution you'd like**
```py
sg = Subgrounds()
uniswapV2 = sg.load_subgraph('https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2')

# Fetch the pair and all its non-list scalar values with the id '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc'
some_pair = uniswapV2.Pair('0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc')

# Since txCount is a non-list scalar, the field's value would be prefetched
# and reading it would not send a new query
num_tx = some_pair.txCount

# Since token0 is not a scalar value, then it would be fetched at read
# time and reading it would imply sengin a new query (all handled in the background)
token0_symbol = some_pair.token0.symbol
```

*Originally from: cvauclair*

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Look at the Subgrounds codebase for how queries are built and executed, likely in query modules. Understand the GraphQL schema handling for entities and scalar fields. The change involves modifying the query generation to fetch only scalar fields initially and defer nested entity queries. Check existing tests for query patterns to ensure compatibility.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
graphql, python
Bereich
api, backend
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.