From 7ec2f82a9ffe74207efc6e4b5836dab23ba63b1e Mon Sep 17 00:00:00 2001 From: Quigley Malcolm Date: Mon, 25 Mar 2024 14:45:48 -0700 Subject: [PATCH] Use keyword arguments when instantiating `Note` events in freshness.py 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. --- core/dbt/task/freshness.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/core/dbt/task/freshness.py b/core/dbt/task/freshness.py index ff1159ab6e6..4b32902b1ec 100644 --- a/core/dbt/task/freshness.py +++ b/core/dbt/task/freshness.py @@ -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( @@ -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