From 45d7bcea7ee87bd6ad4cbe771aa30afd0396dd44 Mon Sep 17 00:00:00 2001 From: Gerda Shank Date: Mon, 16 Aug 2021 12:58:47 -0400 Subject: [PATCH] [#3757] Produce better information about partial parsing version mismatches. --- CHANGELOG.md | 1 + core/dbt/parser/manifest.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 608caed3dc0..c4dc4f60ff6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Under the hood - Add `build` RPC method, and a subset of flags for `build` task ([#3595](https://github.com/dbt-labs/dbt/issues/3595), [#3674](https://github.com/dbt-labs/dbt/pull/3674)) +- Get more information on partial parsing version mismatches ([#3757](https://github.com/dbt-labs/dbt/issues/3757), [#3758](https://github.com/dbt-labs/dbt/pull/3758)) ## dbt 0.21.0b1 (August 03, 2021) diff --git a/core/dbt/parser/manifest.py b/core/dbt/parser/manifest.py index 26918fb9af2..4bb3df2cb4d 100644 --- a/core/dbt/parser/manifest.py +++ b/core/dbt/parser/manifest.py @@ -478,6 +478,12 @@ def write_manifest_for_partial_parse(self): path = os.path.join(self.root_project.target_path, PARTIAL_PARSE_FILE_NAME) try: + # This shouldn't be necessary, but we have gotten bug reports (#3757) of the + # saved manifest not matching the code version. + if self.manifest.metadata.dbt_version != __version__: + logger.debug("Manifest metadata did not contain correct version. " + f"Contained '{self.manifest.metadata.dbt_version}' instead.") + self.manifest.metadata.dbt_version = __version__ manifest_msgpack = self.manifest.to_msgpack() make_directory(os.path.dirname(path)) with open(path, 'wb') as fp: @@ -493,7 +499,10 @@ def is_partial_parsable(self, manifest: Manifest) -> Tuple[bool, Optional[str]]: reparse_reason = None if manifest.metadata.dbt_version != __version__: - logger.info("Unable to do partial parsing because of a dbt version mismatch") + # #3757 log both versions because of reports of invalid cases of mismatch. + logger.info("Unable to do partial parsing because of a dbt version mismatch. " + f"Saved manifest version: {manifest.metadata.dbt_version}. " + f"Current version: {__version__}.") # If the version is wrong, the other checks might not work return False, ReparseReason.version_mismatch if self.manifest.state_check.vars_hash != manifest.state_check.vars_hash: