Skip to content

Commit cf07a33

Browse files
Merge branch 'master' into feature/variable-number-of-columns-allowed
2 parents 08fa1fb + 8b5f82e commit cf07a33

29 files changed

Lines changed: 69 additions & 30 deletions

File tree

docs/_snippets/quickstart-package-install.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Some packages we recommend you check out: [dbt_utils](https://github.com/dbt-lab
3939
```yml packages.yml
4040
packages:
4141
- package: elementary-data/elementary
42-
version: 0.19.1
42+
version: 0.19.2
4343
## Docs: https://docs.elementary-data.com
4444
```
4545
</Step>

elementary/monitor/alerts/source_freshness_alert.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,16 @@ def error_message(self) -> str:
154154

155155
@property
156156
def summary(self) -> str:
157+
source_fqn = ".".join(
158+
[
159+
part
160+
for part in [self.database_name, self.schema_name, self.identifier]
161+
if part
162+
]
163+
)
157164
if self.original_status == "runtime error":
158-
return f'Failed to calculate the source freshness of "{self.source_name}"'
159-
return f'Freshness exceeded the acceptable times on source "{self.source_name}"'
165+
return f'Failed to calculate the source freshness of "{source_fqn}"'
166+
return f'Freshness exceeded the acceptable times on source "{source_fqn}"'
160167

161168
def get_report_link(self) -> Optional[ReportLinkData]:
162169
return get_test_runs_link(self.report_url, self.source_freshness_execution_id)

elementary/monitor/data_monitoring/report/data_monitoring_report.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from elementary.monitor.data_monitoring.schema import FiltersSchema
2222
from elementary.tracking.anonymous_tracking import AnonymousTracking
2323
from elementary.tracking.tracking_interface import Tracking
24+
from elementary.utils import json_utils
2425
from elementary.utils.log import get_logger
2526

2627
logger = get_logger(__name__)
@@ -74,7 +75,7 @@ def generate_report(
7475
with open(template_html_path, "r", encoding="utf-8") as template_html_file:
7576
template_html_code = template_html_file.read()
7677

77-
dumped_output_data = json.dumps(output_data)
78+
dumped_output_data = json.dumps(json_utils.inf_and_nan_to_str(output_data))
7879
encoded_output_data = base64.b64encode(dumped_output_data.encode("utf-8"))
7980
compiled_output_html = (
8081
f"<script>"

elementary/monitor/dbt_project/package-lock.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ packages:
22
- package: dbt-labs/dbt_utils
33
version: 0.8.6
44
- package: elementary-data/elementary
5-
version: 0.19.1
6-
sha1_hash: ad4c29e72e9857c4c4bc91f3ae8bd82465cea34a
5+
version: 0.19.2
6+
sha1_hash: fb182360b3c74342aba55c5046a4139e2f1a6f2f

elementary/monitor/dbt_project/packages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ packages:
22
- package: dbt-labs/dbt_utils
33
version: [">=0.8.0", "<0.9.0"]
44
- package: elementary-data/elementary
5-
version: 0.19.1
5+
version: 0.19.2
66

77
# NOTE - for unreleased CLI versions we often need to update the package version to a commit hash (please leave this
88
# commented, so it will be easy to access)
99
#- git: https://github.com/elementary-data/dbt-data-reliability.git
1010
# revision: f22a2387d19dddd73c8a506d1a9cbb08204f83f9
1111
# When releasing a new version of the package, if the current version is using a commit hash, update the version to the new version.
1212
#- package: elementary-data/elementary
13-
# version: 0.19.1
13+
# version: 0.19.2

elementary/utils/json_utils.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import json
2-
from typing import List, Optional, Union
2+
from typing import Any, List, Optional, Union
3+
4+
import numpy as np
35

46

57
def try_load_json(value: Optional[Union[str, dict, list]]):
@@ -76,3 +78,20 @@ def append_prefix_if_missing(string: str, prefix: str) -> str:
7678
if string.startswith(prefix):
7779
return string
7880
return f"{prefix}{string}"
81+
82+
83+
def inf_and_nan_to_str(obj) -> Any:
84+
"""Replaces occurrences of float("nan") for float("infinity") in the given dict object."""
85+
if isinstance(obj, float):
86+
if np.isinf(obj):
87+
return "Infinity" if obj > 0 else "-Infinity"
88+
elif np.isnan(obj):
89+
return "NaN"
90+
else:
91+
return obj
92+
elif isinstance(obj, dict):
93+
return {k: inf_and_nan_to_str(v) for k, v in obj.items()}
94+
elif isinstance(obj, list):
95+
return [inf_and_nan_to_str(i) for i in obj]
96+
else:
97+
return obj

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "elementary-data"
3-
version = "0.19.3"
3+
version = "0.19.4"
44
description = "Data monitoring and lineage"
55
authors = ["Elementary"]
66
keywords = ["data", "lineage", "data lineage", "data warehouse", "DWH", "observability", "data monitoring", "data observability", "Snowflake", "BigQuery", "Redshift", "data reliability", "analytics engineering"]

tests/unit/alerts/alert_messages/fixtures/adaptive_card/source_freshness_alert_status-error_link-False_message-False_tags-True_owners-True_path-True_error-True_suppression-False_env-False.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"items": [
1111
{
1212
"type": "TextBlock",
13-
"text": "Error: Freshness exceeded the acceptable times on source \"test_source\"",
13+
"text": "Error: Freshness exceeded the acceptable times on source \"test_db.test_schema.test_identifier\"",
1414
"weight": "bolder",
1515
"size": "large",
1616
"wrap": true

tests/unit/alerts/alert_messages/fixtures/adaptive_card/source_freshness_alert_status-error_link-False_message-True_tags-True_owners-True_path-False_error-True_suppression-False_env-True.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"items": [
1111
{
1212
"type": "TextBlock",
13-
"text": "Error: Freshness exceeded the acceptable times on source \"test_source\"",
13+
"text": "Error: Freshness exceeded the acceptable times on source \"test_db.test_schema.test_identifier\"",
1414
"weight": "bolder",
1515
"size": "large",
1616
"wrap": true

tests/unit/alerts/alert_messages/fixtures/adaptive_card/source_freshness_alert_status-error_link-True_message-False_tags-False_owners-False_path-False_error-False_suppression-True_env-False.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"items": [
1111
{
1212
"type": "TextBlock",
13-
"text": "Error: Freshness exceeded the acceptable times on source \"test_source\"",
13+
"text": "Error: Freshness exceeded the acceptable times on source \"test_db.test_schema.test_identifier\"",
1414
"weight": "bolder",
1515
"size": "large",
1616
"wrap": true

0 commit comments

Comments
 (0)