|
11 | 11 | from dbt_artifacts_parser.parser import parse_run_results, parse_manifest
|
12 | 12 | from dbt.config.renderer import ProfileRenderer
|
13 | 13 |
|
14 |
| -from data_diff.errors import DbtBigQueryOauthOnlyError, DbtConnectionNotImplementedError, DbtCoreNoRunnerError, DbtNoSuccessfulModelsInRunError, DbtProfileNotFoundError, DbtProjectVarsNotFoundError, DbtRedshiftPasswordOnlyError, DbtRunResultsVersionError, DbtSelectNoMatchingModelsError, DbtSelectUnexpectedError, DbtSelectVersionTooLowError, DbtSnowflakeSetConnectionError |
| 14 | +from data_diff.errors import ( |
| 15 | + DbtBigQueryOauthOnlyError, |
| 16 | + DbtConnectionNotImplementedError, |
| 17 | + DbtCoreNoRunnerError, |
| 18 | + DbtNoSuccessfulModelsInRunError, |
| 19 | + DbtProfileNotFoundError, |
| 20 | + DbtProjectVarsNotFoundError, |
| 21 | + DbtRedshiftPasswordOnlyError, |
| 22 | + DbtRunResultsVersionError, |
| 23 | + DbtSelectNoMatchingModelsError, |
| 24 | + DbtSelectUnexpectedError, |
| 25 | + DbtSelectVersionTooLowError, |
| 26 | + DbtSnowflakeSetConnectionError, |
| 27 | +) |
15 | 28 |
|
16 | 29 | from .utils import getLogger, get_from_dict_with_raise
|
17 | 30 | from .version import __version__
|
@@ -95,7 +108,9 @@ def __init__(self, profiles_dir_override: str, project_dir_override: str) -> Non
|
95 | 108 |
|
96 | 109 | def get_datadiff_variables(self) -> dict:
|
97 | 110 | doc_url = "https://docs.datafold.com/development_testing/open_source#configure-your-dbt-project"
|
98 |
| - exception = DbtProjectVarsNotFoundError(f"vars: data_diff: section not found in dbt_project.yml.\n\nTo solve this, please configure your dbt project: \n{doc_url}\n") |
| 111 | + exception = DbtProjectVarsNotFoundError( |
| 112 | + f"vars: data_diff: section not found in dbt_project.yml.\n\nTo solve this, please configure your dbt project: \n{doc_url}\n" |
| 113 | + ) |
99 | 114 | vars_dict = get_from_dict_with_raise(self.project_dict, "vars", exception)
|
100 | 115 | return get_from_dict_with_raise(vars_dict, "data_diff", exception)
|
101 | 116 |
|
@@ -180,7 +195,9 @@ def get_run_results_models(self):
|
180 | 195 | self.profiles_dir = legacy_profiles_dir()
|
181 | 196 |
|
182 | 197 | if dbt_version < parse_version(LOWER_DBT_V):
|
183 |
| - raise DbtRunResultsVersionError(f"Found dbt: v{dbt_version} Expected the dbt project's version to be >= {LOWER_DBT_V}") |
| 198 | + raise DbtRunResultsVersionError( |
| 199 | + f"Found dbt: v{dbt_version} Expected the dbt project's version to be >= {LOWER_DBT_V}" |
| 200 | + ) |
184 | 201 | if dbt_version >= parse_version(UPPER_DBT_V):
|
185 | 202 | logger.warning(
|
186 | 203 | f"{dbt_version} is a recent version of dbt and may not be fully tested with data-diff! \nPlease report any issues to https://github.com/datafold/data-diff/issues"
|
@@ -216,25 +233,35 @@ def get_connection_creds(self) -> Tuple[Dict[str, str], str]:
|
216 | 233 | dbt_profile_var = self.project_dict.get("profile")
|
217 | 234 |
|
218 | 235 | profile = get_from_dict_with_raise(
|
219 |
| - profiles, dbt_profile_var, DbtProfileNotFoundError(f"No profile '{dbt_profile_var}' found in '{profiles_path}'.") |
| 236 | + profiles, |
| 237 | + dbt_profile_var, |
| 238 | + DbtProfileNotFoundError(f"No profile '{dbt_profile_var}' found in '{profiles_path}'."), |
220 | 239 | )
|
221 | 240 | # values can contain env_vars
|
222 | 241 | rendered_profile = ProfileRenderer().render_data(profile)
|
223 | 242 | profile_target = get_from_dict_with_raise(
|
224 |
| - rendered_profile, "target", DbtProfileNotFoundError(f"No target found in profile '{dbt_profile_var}' in '{profiles_path}'.") |
| 243 | + rendered_profile, |
| 244 | + "target", |
| 245 | + DbtProfileNotFoundError(f"No target found in profile '{dbt_profile_var}' in '{profiles_path}'."), |
225 | 246 | )
|
226 | 247 | outputs = get_from_dict_with_raise(
|
227 |
| - rendered_profile, "outputs", DbtProfileNotFoundError(f"No outputs found in profile '{dbt_profile_var}' in '{profiles_path}'.") |
| 248 | + rendered_profile, |
| 249 | + "outputs", |
| 250 | + DbtProfileNotFoundError(f"No outputs found in profile '{dbt_profile_var}' in '{profiles_path}'."), |
228 | 251 | )
|
229 | 252 | credentials = get_from_dict_with_raise(
|
230 | 253 | outputs,
|
231 | 254 | profile_target,
|
232 |
| - DbtProfileNotFoundError(f"No credentials found for target '{profile_target}' in profile '{dbt_profile_var}' in '{profiles_path}'."), |
| 255 | + DbtProfileNotFoundError( |
| 256 | + f"No credentials found for target '{profile_target}' in profile '{dbt_profile_var}' in '{profiles_path}'." |
| 257 | + ), |
233 | 258 | )
|
234 | 259 | conn_type = get_from_dict_with_raise(
|
235 | 260 | credentials,
|
236 | 261 | "type",
|
237 |
| - DbtProfileNotFoundError(f"No type found for target '{profile_target}' in profile '{dbt_profile_var}' in '{profiles_path}'."), |
| 262 | + DbtProfileNotFoundError( |
| 263 | + f"No type found for target '{profile_target}' in profile '{dbt_profile_var}' in '{profiles_path}'." |
| 264 | + ), |
238 | 265 | )
|
239 | 266 | conn_type = conn_type.lower()
|
240 | 267 |
|
|
0 commit comments