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

runQuery argument fails when there are multiple steps with the same name #81

Open
bernardosrulzon opened this issue Jan 11, 2017 · 5 comments

Comments

@bernardosrulzon
Copy link

It's a corner case, but I thought it was worth reporting. When you have 2+ steps with the same name, the runQuery argument only looks for the specified query within the first step. It fails to find a query that is in the second step, for example.

@alexanderdean
Copy link
Member

Thanks for flagging! We should probably raise an "ambiguous runQuery argument" error?

@jbeemster
Copy link
Member

I like the idea of an ambiguous runQuery exception!

@bernardosrulzon
Copy link
Author

I'd raise this error only when the step + query combination doesn't point to a single query. In my use case, even though I had multiple steps with the same name, the query name was unique. I'd expect SQL runner to run that query.

Does that make sense?

@jbeemster
Copy link
Member

I guess I would argue that a step should be unique - and that if you had two or more steps with the same name but different operations that you are introducing ambiguity and debug difficulty. If a step does fundamentally different things then it should have a different name otherwise the step name has lost its meaning.

All that being said I would love to hear the use-case for having multiple steps with the same name?

@bernardosrulzon
Copy link
Author

bernardosrulzon commented Jan 12, 2017

I used it to run queries that belong to the same context, but are not independent and can't be run in parallel. Quick example is the session data model. Guess it makes sense to have different names, though.

- :name: 02-sessions
    :queries:
      - :name: 02-01-basic
        :file: gn-snowplow/5-data-modeling/sql-runner/redshift/sql/web-recalculate/02-sessions/02-01-basic.sql
  - :name: 02-sessions
    :queries:
      - :name: 02-02-geo
        :file: gn-snowplow/5-data-modeling/sql-runner/redshift/sql/web-recalculate/02-sessions/02-02-geo.sql
      - :name: 02-03-landing-page
        :file: gn-snowplow/5-data-modeling/sql-runner/redshift/sql/web-recalculate/02-sessions/02-03-landing-page.sql
      - :name: 02-04-exit-page
        :file: gn-snowplow/5-data-modeling/sql-runner/redshift/sql/web-recalculate/02-sessions/02-04-exit-page.sql
      - :name: 02-05-source
        :file: gn-snowplow/5-data-modeling/sql-runner/redshift/sql/web-recalculate/02-sessions/02-05-source.sql
      - :name: 02-06-tech
        :file: gn-snowplow/5-data-modeling/sql-runner/redshift/sql/web-recalculate/02-sessions/02-06-tech.sql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants