Repository: dbt-labs/dbt-core

Issue:
[CT-1499] Fix f-string in `CacheMiss` message
It looks like there's an extra set of quotes in the message for CacheMiss, such that it always prints out as:
```
On "macro_my_macro": cache miss for schema "{self.database}.{self.schema}", this is inefficient
```
I think this:
https://github.com/dbt-labs/dbt-core/blob/68d06d8a9cea28600ed9c3f375605c9467247316/core/dbt/events/types.py#L539-L543

Is just missing an important letter f:
```python
 def message(self) -> str: 
     return ( 
         f'On "{self.conn_name}": cache miss for schema ' 
         f'"{self.database}.{self.schema}", this is inefficient' 
     )
```
```
On "macro_my_macro": cache miss for schema "jerco.dbt_jcohen", this is inefficient
```


Discussion:

Resolving patch:
diff --git a/core/dbt/events/types.py b/core/dbt/events/types.py
--- a/core/dbt/events/types.py
+++ b/core/dbt/events/types.py
@@ -290,7 +290,7 @@ def code(self):
         return "A026"
 
     def message(self) -> str:
-        return """
+        return f"""
 Your new dbt project "{self.project_name}" was created!
 
 For more information on how to configure the profiles.yml file,
@@ -463,7 +463,7 @@ def code(self):
         return "E005"
 
     def message(self) -> str:
-        return f'Acquiring new {self.conn_type} connection "{self.conn_name}"'
+        return f"Acquiring new {self.conn_type} connection '{self.conn_name}'"
 
 
 @dataclass
@@ -539,7 +539,7 @@ def code(self):
     def message(self) -> str:
         return (
             f'On "{self.conn_name}": cache miss for schema '
-            '"{self.database}.{self.schema}", this is inefficient'
+            f'"{self.database}.{self.schema}", this is inefficient'
         )
 
 
@@ -625,7 +625,7 @@ def code(self):
     def message(self) -> str:
         return (
             f"{self.dep_key} references {str(self.ref_key)} "
-            "but {self.ref_key.database}.{self.ref_key.schema}"
+            f"but {self.ref_key.database}.{self.ref_key.schema}"
             "is not in the cache, skipping assumed external relation"
         )
 
@@ -683,7 +683,7 @@ def code(self):
     def message(self) -> str:
         return (
             f"updated reference from {self.old_key} -> {self.cached_key} to "
-            "{self.new_key} -> {self.cached_key}"
+            f"{self.new_key} -> {self.cached_key}"
         )
 
 
@@ -1159,18 +1159,15 @@ def code(self):
         return "I050"
 
     def message(self) -> str:
-
         target_package_string = ""
+
         if self.target_package != target_package_string:
-            target_package_string = "in package '{}' ".format(self.target_package)
-
-        msg = "{} '{}' ({}) depends on a {} named '{}' {}which is disabled".format(
-            self.resource_type_title,
-            self.unique_id,
-            self.original_file_path,
-            self.target_kind,
-            self.target_name,
-            target_package_string,
+            target_package_string = f"in package '{self.target_package}' "
+
+        msg = (
+            f"{self.resource_type_title} '{self.unique_id}' "
+            f"({self.original_file_path}) depends on a {self.target_kind} "
+            f"named '{self.target_name}' {target_package_string}which is disabled"
         )
 
         return warning_tag(msg)
@@ -1320,17 +1317,14 @@ def message(self) -> str:
             reason = "was not found"
 
         target_package_string = ""
+
         if self.target_package is not None:
-            target_package_string = "in package '{}' ".format(self.target_package)
-
-        msg = "{} '{}' ({}) depends on a {} named '{}' {}which {}".format(
-            self.resource_type_title,
-            self.unique_id,
-            self.original_file_path,
-            self.target_kind,
-            self.target_name,
-            target_package_string,
-            reason,
+            target_package_string = f"in package '{self.target_package}' "
+
+        msg = (
+            f"{self.resource_type_title} '{self.unique_id}' "
+            f"({self.original_file_path}) depends on a {self.target_kind} "
+            f"named '{self.target_name}' {target_package_string}which {reason}"
         )
 
         return warning_tag(msg)
@@ -1523,10 +1517,8 @@ def code(self):
         return "M019"
 
     def message(self) -> str:
-        return "Updates available for packages: {} \
-                \nUpdate your versions in packages.yml, then run dbt deps".format(
-            self.packages.value
-        )
+        return f"Updates available for packages: {self.packages.value} \
+                \nUpdate your versions in packages.yml, then run dbt deps"
 
 
 @dataclass
@@ -1884,7 +1876,7 @@ def code(self):
         return "Q022"
 
     def message(self) -> str:
-        msg = "CANCEL query {}".format(self.conn_name)
+        msg = f"CANCEL query {self.conn_name}"
         return format_fancy_output_line(msg=msg, status=red("CANCEL"), index=None, total=None)
 
 
@@ -1986,7 +1978,7 @@ def code(self):
         return "Q033"
 
     def message(self) -> str:
-        msg = "OK hook: {}".format(self.statement)
+        msg = f"OK hook: {self.statement}"
         return format_fancy_output_line(
             msg=msg,
             status=green(self.status),
@@ -2070,15 +2062,13 @@ def code(self):
         return "W003"
 
     def message(self) -> str:
-        prefix = "Internal error executing {}".format(self.build_path)
+        prefix = f"Internal error executing {self.build_path}"
 
         internal_error_string = """This is an error in dbt. Please try again. If \
 the error persists, open an issue at https://github.com/dbt-labs/dbt-core
 """.strip()
 
-        return "{prefix}\n{error}\n\n{note}".format(
-            prefix=red(prefix), error=str(self.exc).strip(), note=internal_error_string
-        )
+        return f"{red(prefix)}\n" f"{str(self.exc).strip()}\n\n" f"{internal_error_string}"
 
 
 @dataclass
@@ -2090,8 +2080,8 @@ def message(self) -> str:
         node_description = self.build_path
         if node_description is None:
             node_description = self.unique_id
-        prefix = "Unhandled error while executing {}".format(node_description)
-        return "{prefix}\n{error}".format(prefix=red(prefix), error=str(self.exc).strip())
+        prefix = f"Unhandled error while executing {node_description}"
+        return f"{red(prefix)}\n{str(self.exc).strip()}"
 
 
 @dataclass
@@ -2100,7 +2090,7 @@ def code(self):
         return "W005"
 
     def message(self) -> str:
-        return "Error releasing connection for node {}: {!s}".format(self.node_name, self.exc)
+        return f"Error releasing connection for node {self.node_name}: {str(self.exc)}"
 
 
 @dataclass
@@ -2409,9 +2399,9 @@ def message(self) -> str:
         if self.keyboard_interrupt:
             message = yellow("Exited because of keyboard interrupt.")
         elif self.num_errors > 0:
-            message = red("Completed with {} and {}:".format(error_plural, warn_plural))
+            message = red(f"Completed with {error_plural} and {warn_plural}:")
         elif self.num_warnings > 0:
-            message = yellow("Completed with {}:".format(warn_plural))
+            message = yellow(f"Completed with {warn_plural}:")
         else:
             message = green("Completed successfully")
         return message


Test patch: