Skip to content

Commit

Permalink
Merge pull request #1038 from elementary-data/ele-1433-calling-dbt-de…
Browse files Browse the repository at this point in the history
…ps-earlier-in-edr-logic

Running 'dbt deps' earlier in edr's logic.
  • Loading branch information
elongl authored Jul 31, 2023
2 parents 16d0655 + d78d708 commit 6f5fc1e
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions elementary/monitor/data_monitoring/data_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ def __init__(
disable_samples: bool = False,
filter: Optional[str] = None,
):
self.execution_properties: Dict[str, Any] = {}
self.config = config
self.tracking = tracking
self.internal_dbt_runner = self._init_internal_dbt_runner()
self.user_dbt_runner = self._init_user_dbt_runner()

self.execution_properties: Dict[str, Any] = {}
self._download_dbt_package_if_needed(force_update_dbt_package)
latest_invocation = self.get_latest_invocation()
self.project_name = latest_invocation.get("project_name")
dbt_pkg_version = latest_invocation.get("elementary_version")
Expand All @@ -59,7 +59,6 @@ def __init__(
self.slack_client = SlackClient.create_client(
self.config, tracking=self.tracking
)
self._download_dbt_package_if_needed(force_update_dbt_package)
self.elementary_database_and_schema = self.get_elementary_database_and_schema()
self.success = True
self.disable_samples = disable_samples
Expand Down Expand Up @@ -175,17 +174,11 @@ def _check_dbt_package_compatibility(dbt_pkg_ver_str: str) -> None:
)

def _get_warehouse_info(self, hash_id: bool = False) -> Optional[WarehouseInfo]:
dbt_runner = DbtRunner(
dbt_project_utils.PATH,
self.config.profiles_dir,
self.config.profile_target,
env_vars=self.config.env_vars,
)
try:
warehouse_type, warehouse_unique_id = json.loads(
dbt_runner.run_operation("get_adapter_type_and_unique_id", quiet=True)[
0
]
self.internal_dbt_runner.run_operation(
"get_adapter_type_and_unique_id", quiet=True
)[0]
)
return WarehouseInfo(
id=warehouse_unique_id if not hash_id else hash(warehouse_unique_id),
Expand Down

0 comments on commit 6f5fc1e

Please sign in to comment.