Getting More Data#
Click for Interactive Documentation
Clicking this button will enable editing and execution of the code-blocks on this page. Learn more here.
By default, subgraphs will emit only 100 rows for a given entity. In order to surface more data from an entity, you must leverage field arguments, specifically the first argument. This specifies how many entities you wish to retrieve from that specific entity.
from subgrounds import Subgrounds
with Subgrounds() as sg:
curve = sg.load_subgraph(
"https://api.thegraph.com/subgraphs/name/messari/curve-finance-ethereum")
sg.query_df(
curve.Query.financialsDailySnapshots(first=2500)
)
Note
It is possible to query more than a 100 rows worth of data without specifying a first argument by using nested fields. Essentially, you would be querying multiple rows for each row as subgrounds would paginated the nested field and then auto-flatten said field.
Pagination#
Subgraphs and GraphQL usually restrict you to a maximum first argument of 1000. In subgrounds, you can specify as large as a number as you want as subgrounds will automatically create multiple, paginated, requests to retrieve more data. This means you'll be able to access all the data from an entity by just setting the first argument to a high-enough number!