soda-core icon indicating copy to clipboard operation
soda-core copied to clipboard

Scan exit code 3: Error occurred while executing scan

Open manishjoshii opened this issue 1 year ago • 3 comments

Hi All, I am a new user of soda and successfully connected soda to a BigQuery dataset. However, when I run the checks, it fails with exit code 3. Has anyone faced this issue? I am still debugging but would be grateful if anyone has a fix for this issue. Based on the documentation, scan exit code 3 indicates a runtime issue. Details are below: Base code:

`from soda.scan import Scan

scan = Scan()

scan.add_configuration_yaml_file(file_path="configuration.yml") scan.set_data_source_name('db_ca_kerry')

scan.add_sodacl_yaml_file("checks.yml")

exit_code = scan.execute() print('exit_code is', exit_code)

scan.set_verbose(True) scan.get_scan_results() print(scan.get_logs_text()) `

The checks.yml file: `checks:

  • row_count > 0`

I can connect successfully to the bigquery dataset

Error Message: [18:17:02] Error occurred while executing scan. | 'NoneType' object has no attribute 'ensure_query_for_metric' exit_code is 3 INFO | Soda Core 3.3.1 ERROR | Error occurred while executing scan. | 'NoneType' object has no attribute 'ensure_query_for_metric'

Many thanks for your help and insights on the solution!

manishjoshii avatar Apr 09 '24 17:04 manishjoshii

SAS-3207

tools-soda avatar Apr 09 '24 17:04 tools-soda

The checks.yml file had the dataset table name missing which I added. The revised checks.yml file is given below:

checks for <db_table_name>: - row_count > 0

This fixes the error and I am able to run soda successfully now.

mjoshii avatar Apr 09 '24 20:04 mjoshii

This error ('NoneType' object has no attribute 'ensure_query_for_metric') can be caused by some mistake in the formatting or usage of your checks.yml or configuration.yml. Some things to check:

  • Your formatting of the YAML files is correct YAML formatting (you can run it through an online formatter to assist you there, e.g. https://www.yamllint.com/)
  • You are setting the correct data source name (as how it's defined in your configuration.yml)

dirkgroenen avatar Apr 10 '24 04:04 dirkgroenen