Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subgraphs with _type fail at auto-select #33

Open
0xMochan opened this issue May 31, 2023 · 0 comments
Open

Subgraphs with _type fail at auto-select #33

0xMochan opened this issue May 31, 2023 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@0xMochan
Copy link
Collaborator

Describe the bug
With Subgrounds feature of auto select when given a top-level field or entity, it automatically grabs every scalar field + every object field's id. This will clash causing non-sense errors if a subgraph has a rare _type or other variable that exists on the FieldPath object.

To Reproduce
Steps to reproduce the behavior:

  1. Test out this snippet of code with the latest subgrounds
from subgrounds import Subgrounds

sg = Subgrounds()
aave_v2 = sg.load_subgraph("https://api.thegraph.com/subgraphs/name/messari/aave-v2-ethereum")
sg.query_df(aave_v2.Query.markets)
  1. Observe an absurd stack limit error dealing with crazy recursion.

Expected behavior
There should be no clash and the data should be accessed

Python version (please complete the following information):

  • Python 3.11 w/ Subgrounds 1.6.0

Additional context
Potential Solutions:
a) we rename all internal variables of FieldPath (and Subgraph) to start with __ to enable python's name-mangling
b) we replace __getattribute__ with __getattr__ so that internal vars don't go thru a special access layer

  • this would enforce the use of ._select if there was a name clash with a field

Doing both a) and b) could be ideal since the name-mangle will reduce collisions and the __getattr__ would ensure consistent and crashless behavior in edge cases.

Likely, the hardest part to fixing this issue is fixing all of the test cases as well.

@0xMochan 0xMochan added bug Something isn't working good first issue Good for newcomers labels May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant