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

Inline SyntheticFields #49

Open
2 tasks
cvauclair opened this issue Jul 15, 2022 · 0 comments
Open
2 tasks

Inline SyntheticFields #49

cvauclair opened this issue Jul 15, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@cvauclair
Copy link
Contributor

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 fpaths argument of toplevel functions (e.g.: query_df) which will generate temporary transformation layers on the fly for the inline SyntheticFields
  • Tests!
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