sodadata / soda-sql

Soda SQL and Soda Spark have been deprecated and replaced by Soda Core. docs.soda.io/soda-core/overview.html
https://docs.soda.io/
Apache License 2.0
61 stars 16 forks source link

Scan fails when a historic metric does not exist #162

Open albinkjellin opened 2 years ago

albinkjellin commented 2 years ago

Describe the bug The first time you run a scan using a historic metric it will not work since no historic metrics are available. This will stop the execution of the rest of the scans which does not seem correct.

I will throw this error:

Traceback (most recent call last):
 File "/Users/albin/dev/py/env/2.1.0b21/lib/python3.9/site-packages/sodasql/scan/scan.py", line 105, in execute
  self._run_column_tests()
 File "/Users/albin/dev/py/env/2.1.0b21/lib/python3.9/site-packages/sodasql/scan/scan.py", line 812, in _run_column_tests
  historic_metric_variables = self._get_historic_metric_variables(scan_column)
 File "/Users/albin/dev/py/env/2.1.0b21/lib/python3.9/site-packages/sodasql/scan/scan.py", line 787, in _get_historic_metric_variables
  raise RuntimeError('\n'.join(errors))
RuntimeError: Error in fetching historical metric avg_max_5: Insufficient measurements: requested 5 but found only 1
 | Soda Cloud scan end with errors

To Reproduce Steps to reproduce the behavior:

  1. Create a new test in scan.yml
  2. Run soda scan ... 3 ...

Context Include your scan.yml or warehouse.yml when relevant

OS: Python Version: Soda SQL Version: 2.1.0b21 Warehouse Type: