|
8 | 8 | from Expectation_report_new import ExpectationsReportNew |
9 | 9 | from pandas_profiling.expectations_report import ExpectationsReport |
10 | 10 | from datetime import datetime |
11 | | -from great_expectations import DataContext |
12 | 11 | from great_expectations.data_context import BaseDataContext |
13 | 12 | from great_expectations.data_context.types.base import (DataContextConfig, |
14 | 13 | S3StoreBackendDefaults) |
15 | 14 | import yaml |
16 | | - |
| 15 | +DEFAULT_CONFIG_FILE_PATH = "great_expectations/great_expectations.yml" |
17 | 16 |
|
18 | 17 | if os.environ['ENVIRONMENT'] == 'local': |
19 | 18 | endpoint_url = f"http://{os.environ['S3_HOST']}:{os.environ['S3_PORT']}" |
@@ -66,11 +65,7 @@ def __init__(self, typeset, *args, **kwargs): |
66 | 65 |
|
67 | 66 |
|
68 | 67 | def change_ge_config(datasource_root): |
69 | | - context_ge = DataContext() |
70 | | - |
71 | | - configfile_raw = context_ge.get_config().to_yaml_str() |
72 | | - configfile = yaml.safe_load(configfile_raw) |
73 | | - |
| 68 | + configfile = read_gx_config_file() |
74 | 69 | datasources = { |
75 | 70 | "pandas_s3": { |
76 | 71 | "class_name": "PandasDatasource", |
@@ -151,7 +146,15 @@ def remove_suffix(input_string, suffix): |
151 | 146 | return input_string |
152 | 147 |
|
153 | 148 |
|
154 | | -def profile_data(df, suite_name, cloudfront, datasource_root, source_covered, |
| 149 | +def read_gx_config_file(path=None) -> dict: |
| 150 | + if path is None: |
| 151 | + path = DEFAULT_CONFIG_FILE_PATH |
| 152 | + with open(path, "r") as config_file: |
| 153 | + configfile = yaml.safe_load(config_file) |
| 154 | + return configfile |
| 155 | + |
| 156 | + |
| 157 | +def profile_data(df, suite_name, cloudfront, datasource_root, source_covered, |
155 | 158 | mapping_config, run_name): |
156 | 159 | qa_bucket = s3.Bucket(qa_bucket_name) |
157 | 160 | config = change_ge_config(datasource_root) |
|
0 commit comments