snowplow / sql-runner

Run templatable playbooks of SQL scripts in series and parallel on Redshift, PostgreSQL, BigQuery and Snowflake
http://snowplowanalytics.com
Apache License 2.0
79 stars 14 forks source link

Fail fast on invalid playbook #207

Closed adatzer closed 2 years ago

adatzer commented 2 years ago

At the moment, if a playbook has no targets or no steps provided, Run is still called from main. Since Run returns TargetStatus, missing targets leads to various for loops being skipped, which makes it harder to reason about the return value, and ends up in No queries to run error. Similarly for steps, which, if missing, []Step is nil, which goes unnoticed till runSteps (after the target client has been created). Until we get to https://github.com/snowplow/sql-runner/issues/149, we could just fail fast instead, with a more relevant error message.