Christian Sanchez
12/08/2023, 7:43 PMNameError: name 'get_run_context' is not defined
Here is my slightly modified code (modified to find the yaml
files):
from prefect import flow
from prefect_soda_core.soda_configuration import SodaConfiguration
from prefect_soda_core.sodacl_check import SodaCLCheck
from prefect_soda_core.tasks import soda_scan_execute
@flow
def run_soda_scan():
soda_configuration_block = SodaConfiguration(
configuration_yaml_path="./soda/configuration.yaml"
)
soda_check_block = SodaCLCheck(
sodacl_yaml_path="./soda/checks.yaml"
)
# Using the flow_run_name as the name of the file to store the scan results
flow_run_name = get_run_context().flow_run.name
scan_results_file_path = f"{flow_run_name}.json"
return soda_scan_execute(
data_source_name="my_datasource",
configuration=soda_configuration_block,
checks=soda_check_block,
variables={"var": "value"},
scan_results_file=scan_results_file_path,
verbose=True,
return_scan_result_file_content=False,
)
run_soda_scan()
Nate
12/08/2023, 7:46 PMfrom prefect.context import get_run_context
Christian Sanchez
12/08/2023, 7:48 PMChristian Sanchez
12/08/2023, 7:48 PMNate
12/08/2023, 7:51 PMNate
12/08/2023, 7:51 PMChristian Sanchez
12/08/2023, 7:51 PMChristian Sanchez
12/08/2023, 7:52 PMNate
12/08/2023, 7:52 PMChristian Sanchez
12/08/2023, 7:54 PMNate
12/08/2023, 7:54 PM