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

Synthetic Fields over existing field paths #54

Open
bam4564 opened this issue Sep 3, 2022 · 0 comments
Open

Synthetic Fields over existing field paths #54

bam4564 opened this issue Sep 3, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@bam4564
Copy link

bam4564 commented Sep 3, 2022

Is your feature request related to a problem? Please describe.

A lot of times, what I want to perform when creating a synthetic field is to post-process the queried value of a field path but retain the same name.

Describe the solution you'd like
For example

# Converting decimals for an erc20 token amount transparently 
subgraph.Entity.token_amount = subgraph.Entity.token_amount / 1e6 

This is pretty easy to do in post-processing, but I thought it might be nice to have as a capability for synthetic fields.

Describe alternatives you've considered

When I tried to do something like this for a subgraph I'm working with, I got the following error. At the very least, it would be nice to have a more descriptive error message about this behavior not being allowed.

Exception: transform_response: data for selection Selection(fmeta=TypeMeta.FieldMeta(name='order', description=None, arguments=[], type_=TypeRef.Named(name_='PodOrder')), alias=None, arguments=[], selection=[Selection(fmeta=TypeMeta.FieldMeta(name='status', description=None, arguments=[], type_=TypeRef.NonNull(inner=TypeRef.Named(name_='String'))), alias=None, arguments=[], selection=[]), Selection(fmeta=TypeMeta.FieldMeta(name='pricePerPod', description=None, arguments=[], type_=TypeRef.NonNull(inner=TypeRef.Named(name_='Int'))), alias=None, arguments=[], selection=[])]) is neither list or dict None

Additional context
N/A

Implementation checklist
N/A

@bam4564 bam4564 added the enhancement New feature or request label Sep 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant