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
59 stars 16 forks source link

[Feature] Add support for Path when adding `warehouse_yml_file` and `scan_yml_file` #154

Closed HansBambel closed 2 years ago

HansBambel commented 2 years ago

Is your feature request related to a problem? Please describe. I was following the instructions for programmatic scans and when it came to entering a path to the scan_yml_file and warehouse_yml_file I entered a path using from pathlib import Path:

from pathlib import Path

ROOT_DIR = Path(__file__).parent.parent
scan_builder.warehouse_yml_file = ROOT_DIR / "soda_warehouse_directory" / "warehouse_local.yml"

but I received an error:

scan_builder.scan_yml_file must be str, but was <class 'pathlib.PosixPath'>: /home/my_user/my_repo/soda_warehouse_directory/tables/warehouse_local/my_scan.yml

It works when I just convert the Path to str, but supporting both would be nice since str is more common, but Path is nicer:

scan_builder.warehouse_yml_file = str(ROOT_DIR / "soda_warehouse_directory" / "warehouse_local.yml")

Describe the solution you'd like Allow Path variables as well as str when entering a path to a file.

Soda SQL Version: 2.1.0b18