-
Notifications
You must be signed in to change notification settings - Fork 57
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
Reverse 1:n relationships #37
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good (other than adding the !
). We need to ask @ianlapham if this change would effect their front end because of the filter changes.
Also, maybe we should announce it in discord? Maybe others use this subgraph?
@@ -60,7 +60,7 @@ type Exchange @entity { | |||
weightedAvgPriceUSD: BigDecimal! # weightAvgPriceUSD = ( $1 of ETH in ETH ) / weightedAvgPrice | |||
|
|||
# Fields used to help derived relationship | |||
factory: Uniswap! @derivedFrom(field: "exchanges") | |||
factory: Uniswap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add a !
to this
Merging this would close #28 |
This makes sense to me - if the performance would greatly improve it might be worth it to update our queries on our frotn-end to support the changes. Is there a way to deploy this to some other subgraph so I could test it first? |
I just deployed it, but I assume lutter already deployed it somewhere because it was instantly synced for me. You can see it here https://thegraph.com/explorer/subgraph/davekaj/uniswap |
Yes, I had deployed it a while ago, and completely forgotten about it; it's also at https://thegraph.com/explorer/subgraph/lutter/uniswap-rels |
great, will merge now |
This pull request reverse how 1:n associations are stored in Uniswap: rather than storing them as an array on the 'n' side, they are now stored as a scalar attribute on the '1' side. Doing it this way makes things much easier for the database when executing queries.
One downside is that changing which side is stored and which side is derived changes what filters are available - if that conflicts with how Uniswap needs to be queried, feel free to ignore any of this.
I did sync with this version of Uniswap on a test system successfully, but I don't know the ins and outs of the subgraph enough to be able to tell whether I broke some other functionality.