0xPlaygrounds / 0xPlaygrounds/subgrounds

Enhance auto selection of FieldPaths with filters on field names

オープン
#31 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement good first issue
主要言語
Python
スター
73
フォーク
12
PR マージ指標
30日以内にマージされた PR はありません

説明

**Is your feature request related to a problem? Please describe.**
Yes! Currently, Sugrounds supports auto-selection of FieldPaths. This means that if you use one of the querying methods (e.g.: `sg.query_df`) with a FieldPath that does not select a scalar value, then Subgrounds will automatically grab all scalar fields available from that partial selection (see code snippet below).

However, especially during the data exploration phase, this is too much data to be useful (users have to go through dozens of columns to find the data that interests them. The other option, to individually select all fields of interest, is tedious and verbose. What is missing is a middle ground between both cases.

Introducing, filtered auto-selections! (not to be confused with filters _on_ selections, i.e.: with the `where` argument). The idea is simple, it would work the same as the regular autocompletion of FieldPaths, while allowing users to specify a filter for the fields they want to select.

**Describe the solution you'd like**
```python
from subgrounds import Subgrounds

sg = Subgrounds()

subgraph = sg.load_subgraph("https://api.thegraph.com/subgraphs/name/messari/uniswap-v3-ethereum")

# Select individual fields
sg.query_df([
subgraph.Query.financialsDailySnapshots.timestamp,
subgraph.Query.financialsDailySnapshots.totalValueLockedUSD,
])

# Auto-select all fields
sg.query_df([
subgraph.Query.financialsDailySnapshots
])

# NEW: Select all fields starting with `cumulative`
sg.query_df([
subgraph.Query.financialsDailySnapshots._select("cumulative*")
])
```

**Describe alternatives you've considered**
None.

**Additional context**
For consistency, `subgraph.Query.financialsDailySnapshots._select("*")` should be equivalent to selecting all the fields (the second case).

**Implementation checklist**
- [ ] Update `FieldPath._select` to be able to handle widlcards

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

The issue is about enhancing FieldPath._select in Subgrounds to support wildcard filters. Start by examining the FieldPath class in the codebase, likely in a file like fieldpath.py. Look for the existing _select method and understand how auto-selection currently works. Then, implement wildcard matching (e.g., 'cumulative*') to filter field names. Test with the provided example using subgraph.Query.financialsDailySnapshots._select("cumulative*") to ensure it selects only fields starting with 'cumulative'.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
graphql, pandas, python
領域
backend-api-design, data
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
65/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。