-
Notifications
You must be signed in to change notification settings - Fork 8
Inline SyntheticFields #49
Description
Is your feature request related to a problem? Please describe.
Yes. Currently, SyntheticFields must be explicitly added to a subgraph object. This works when synthetic fields do not need to change after they are defined. However, to have a SyntheticField that changes over the lifetime of a Subgrounds program, one would have to constantly rebind it. Example:
def query_with_n(n: int):
subgraph.MyEntity.field_plus_n = subgraph.Entity.field + n
return sg.query([
subgraph.Query.myEntities.field_plus_n
])Describe the solution you'd like
Add support for inline SyntheticFields:
def query_with_n_inline(n: int):
sg.query([
subgraph.Query.myEntities.field + n
])This will require figuring out a naming scheme for the inline SyntheticFields since, due to the fact that they are not explicitly added to an object, they do not have a user defined name. Using our example, something like field_N could work, where N is the number of inline SyntheticField using field as dependency (would have to figure out how to extend this to inline SyntheticFields that have multiple field dependencies).
Describe alternatives you've considered
None.
Additional context
None.
Implementation checklist
- Add a new function to Subgrounds object to be applied to the
fpathsargument of toplevel functions (e.g.:query_df) which will generate temporary transformation layers on the fly for the inlineSyntheticFields - Tests!