Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Releases: Protean-Labs/subgrounds

v1.0.3

01 Nov 15:50
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.0.2...v1.0.3

v1.0.2

30 Oct 21:39
Compare
Choose a tag to compare
  • Update SchemaMeta to Pydantic model for extra validation

v1.0.1

08 Aug 17:23
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.0.0...v1.0.1

v1.0.0

25 Jul 19:38
Compare
Choose a tag to compare

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) and ShallowStrategy, which is much faster than LegacyStrategy 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 the pagination_strategy argument (setting the latter to None 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

23 Jun 23:55
Compare
Choose a tag to compare

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, a PaginationError exception will be thrown with the cursor state as attribute cursor 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 and load_api. Defaults to ./schemas/ #41

  • Add useful SyntheticField helper datetime_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 a SyntheticField 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, run pip install subgrounds[dash]

Fixes

  • Fix bug that caused some queries to fail with automatic pagination enable #41

Misc

  • Migrate package manager from pipenv to poetry
  • Migrate docs from plain sphinx to mudkip

v0.1.1

29 Apr 17:17
Compare
Choose a tag to compare

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

27 Apr 21:34
Compare
Choose a tag to compare

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)
Screenshot from 2022-04-19 15-36-01
Screenshot from 2022-04-19 15-34-47

What's Changed

Full Changelog: v0.0.9...v0.1.0

v0.0.9

29 Mar 22:00
Compare
Choose a tag to compare

Notable changes

  • #33 Refactor, cleanup and add tons of docstrings
  • #34 Add new method Subgrounds.load_api which can be used instead of Subgrounds.load_subgraph to safely query non-subgraph GrahpQL APIs with Subgrounds!
  • #34 Add new boolean flag argument auto_paginate to Subgrounds.query, Subgrounds.query_json and Subgrounds.query_df to selectively disable automatic pagination