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

Query.query_id can iterate over results of dependencies #4505

Open
greenape opened this issue Nov 9, 2021 · 2 comments
Open

Query.query_id can iterate over results of dependencies #4505

greenape opened this issue Nov 9, 2021 · 2 comments
Labels
bug Something isn't working FlowMachine Issues related to FlowMachine

Comments

@greenape
Copy link
Member

greenape commented Nov 9, 2021

If you create a query subclass which holds a dict of query objects as an attribute, then calling query_id will cause the id to be generated by iterating through the results of the dependent queries.

e.g.

class UhOh(Query):
  def __init__(self, a_dict):
    self.oh_dear = a_dict
    super().__init__()

  @property
  def column_names(self):
    return ["badness"]

  def _make_query(self):
    return next(self.oh_dear.values()).get_query()
@greenape greenape added bug Something isn't working FlowMachine Issues related to FlowMachine P-Now labels Nov 9, 2021
@greenape
Copy link
Member Author

greenape commented Nov 9, 2021

And as a companion issue - queries in a dict won't get picked up by dependencies either.

@greenape
Copy link
Member Author

Nice suggestion from @jc-harrison that an alternative approach to query ids where we hash on the sql generated 'as if' all dependent queries were cached would resolve this, as well as #4489. Should also facilitate #814, but I would like it to not make #390 worse.

@greenape greenape removed the P-Now label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working FlowMachine Issues related to FlowMachine
Projects
None yet
Development

No branches or pull requests

1 participant