Skip to content

Commit

Permalink
Use keword arguments when instantiating Note events in freshness.py
Browse files Browse the repository at this point in the history
Previously we were passing arguments during the `Note` event instantiations
in freshness.py as positional arguments. This would cause not the desired
`Note` event to be emitted, but instead get the message
```
[Note] Don't use positional arguments when constructing logging events
```
which was our fault, not the users'. Additionally, we were passing the
level for the event in the `Note` instantiation when we needed to be
passing it to the `fire_event` method.
  • Loading branch information
QMalcolm committed Mar 25, 2024
1 parent 6aaaca0 commit a22c40e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions core/dbt/task/freshness.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ def execute(self, compiled_node, manifest):
if compiled_node.freshness.filter is not None:
fire_event(
Note(
f"A filter cannot be applied to a metadata freshness check on source '{compiled_node.name}'.",
EventLevel.WARN,
)
msg=f"A filter cannot be applied to a metadata freshness check on source '{compiled_node.name}'."
),
EventLevel.WARN,
)

adapter_response, freshness = self.adapter.calculate_freshness_from_metadata(
Expand All @@ -133,9 +133,7 @@ def execute(self, compiled_node, manifest):
status = compiled_node.freshness.status(freshness["age"])
else:
status = FreshnessStatus.Warn
fire_event(
Note(f"Skipping freshness for source {compiled_node.name}."),
)
fire_event(Note(msg=f"Skipping freshness for source {compiled_node.name}."))

# adapter_response was not returned in previous versions, so this will be None
# we cannot call to_dict() on NoneType
Expand Down

0 comments on commit a22c40e

Please sign in to comment.