Releases: Protean-Labs/subgrounds
v1.0.3
What's Changed
- fix: synthetic field null object by @cvauclair in #56
Full Changelog: v1.0.2...v1.0.3
v1.0.2
v1.0.1
What's Changed
- fix: schema cache directory path by @cvauclair in #53
- fix:
where
filter getting dropped during pagination by @cvauclair in #52
Full Changelog: v1.0.0...v1.0.1
v1.0.0
Description
This release overhauls how pagination is performed in Subgrounds.
New features
- Subgrounds users can now define and use their own pagination strategy (see Custom pagination strategy for more details).
- Users select the pagination strategies to use when calling toplevel querying functions:
df = sg.query_df(field_paths, pagination_strategy=MyPaginationStrategy)
- Subgrounds provides two pagination strategies out of the box:
LegacyStrategy
(the strategy used prior to this update) andShallowStrategy
, which is much faster thanLegacyStrategy
in some cases, but does not support pagination on nested fields (see Available pagination strategies for more details).
BREAKING CHANGES
- The
auto_paginate
argument of toplevel querying functions has been replaced by thepagination_strategy
argument (setting the latter toNone
disables pagination).
Fixes
- Fix bug that would cause a crash when calling one of the toplevel querying functions with only one FieldPath object (e.g.:
sg.query_df(pairs.id)
.
v0.2.0
Features
-
Iterative versions of toplevel querying functions to allow developers to process queried data page by page when automatic pagination returns more than one page #42
query_df
->query_df_iter
query
->query_iter
query_json
->query_json_iter
execute
->execute_iter
Usage:
>>> univ2 = sg.load_subgraph('https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2') >>> swaps = univ2.Query.swaps( ... first=2000, ... orderBy=univ2.Swap.timestamp, ... orderDirection='desc' ... ) >>> for page_df in sg.query_df_iter([swaps.id]): ... do_something(page_df)
-
When using iterative querying functions (e.g.:
query_df_iter
) and an error occurs during pagination, aPaginationError
exception will be thrown with the cursor state as attributecursor
allowing users to resume pagination by modifying the query's arguments based on the cursor state #42 -
Add option to set subgraph schema cache directory in
load_subgraph
andload_api
. Defaults to./schemas/
#41 -
Add useful
SyntheticField
helperdatetime_of_timestamp
#44 -
Subgrounds
class can now be imported from toplevel module:from subgrounds import Subgrounds
-
Add
SyntheticField.datetime_of_timestamp
helper function to easily create aSyntheticField
that converts a Unix timestamp into a human readable datetime string -
Add
SyntheticField.map
helper function to easily create a "map"SyntheticField
from a dictionary #45 -
Made
dash
an optional extra dependency. To use Subgrounds dash and plotly wrappers, runpip install subgrounds[dash]
Fixes
- Fix bug that caused some queries to fail with automatic pagination enable #41
Misc
- Migrate package manager from
pipenv
topoetry
- Migrate docs from plain
sphinx
tomudkip
v0.1.1
What's Changed
- Fix bug where scalar lists were not handled properly by @cvauclair in #38
Full Changelog: v0.1.0...v0.1.1
v0.1.0
New features
Partial fieldpaths
Querying partial fieldpaths will automatically select all non-list fields of the fieldpath leaf (closes #31).
For example, using the Ribbon V2 subgraph, the following Subgrounds query:
sg.query_df([
ribbon.Query.vaults
])
will result in the following query being made to the subgraph:
query {
vaults {
id
name
symbol
underlyingAsset
underlyingName
underlyingSymbol
underlyingDecimals
totalPremiumEarned
totalNominalVolume
totalNotionalVolume
numDepositors
totalBalance
cap
round
performanceFeeCollected
managementFeeCollected
totalFeeCollected
}
}
Misc
Code completion
When using Subgrounds in Jupyter notebooks and a subgraph has been loaded in a previous cell, fieldpaths will now autocomplete (closes #3)
What's Changed
- Feature/31 by @cvauclair in #35
- Major refactoring to allow for code-completion in Jupyter notebook by @cvauclair in #36
Full Changelog: v0.0.9...v0.1.0
v0.0.9
Notable changes
- #33 Refactor, cleanup and add tons of docstrings
- #34 Add new method
Subgrounds.load_api
which can be used instead ofSubgrounds.load_subgraph
to safely query non-subgraph GrahpQL APIs with Subgrounds! - #34 Add new boolean flag argument
auto_paginate
toSubgrounds.query
,Subgrounds.query_json
andSubgrounds.query_df
to selectively disable automatic pagination