-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Exclude password-like fields for considering reparse #9844
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2f78af0
hash connection_keys as profile
ChenyuLInx 11fc733
changlog
ChenyuLInx 42bbe7a
nits
ChenyuLInx e44b328
nits
ChenyuLInx 3ce11ef
adjust
ChenyuLInx c3f4389
adjust
ChenyuLInx 1055202
adjust_vars
ChenyuLInx f07a86b
nits
ChenyuLInx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Fixes | ||
body: Exclude password-like fields for considering reparse | ||
time: 2024-04-02T13:55:56.169953-07:00 | ||
custom: | ||
Author: ChenyuLInx | ||
Issue: "9795" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,6 +106,18 @@ def _new_file(self, searched, name, match): | |
|
||
|
||
class TestPartialParse(unittest.TestCase): | ||
def setUp(self) -> None: | ||
mock_project = MagicMock(RuntimeConfig) | ||
mock_project.cli_vars = "" | ||
mock_project.args = MagicMock() | ||
mock_project.args.profile = "test" | ||
mock_project.args.target = "test" | ||
mock_project.project_env_vars = {} | ||
mock_project.profile_env_vars = {} | ||
mock_project.project_target_path = "mock_target_path" | ||
mock_project.credentials = MagicMock() | ||
self.mock_project = mock_project | ||
|
||
@patch("dbt.parser.manifest.ManifestLoader.build_manifest_state_check") | ||
@patch("dbt.parser.manifest.os.path.exists") | ||
@patch("dbt.parser.manifest.open") | ||
|
@@ -122,6 +134,17 @@ def test_partial_parse_file_path(self, patched_open, patched_os_exist, patched_s | |
# if specified in flags, we use the specified path | ||
patched_open.assert_called_with("specified_partial_parse_path", "rb") | ||
|
||
def test_partial_parse_profile_change(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name of this test seems to imply that we're asserting that something with partial parsing did or didn't happen. However looking at the test it seems to only assert that the file hash has changed, which is not indicative itself of whether a full or partial parse happened. |
||
# This test validate that the profile_hash is updated when the connection keys change | ||
profile_hash = "6e94a0aef218fd7aef18b257f0ba9fc33c92a2bc9788fc751868e43ab398137f" | ||
self.mock_project.credentials._connection_keys.return_value = "test" | ||
set_from_args(Namespace(), {}) | ||
manifest = ManifestLoader(self.mock_project, {}) | ||
assert manifest.manifest.state_check.profile_hash.checksum == profile_hash | ||
self.mock_project.credentials._connection_keys.return_value = "test1" | ||
manifest = ManifestLoader(self.mock_project, {}) | ||
assert manifest.manifest.state_check.profile_hash.checksum != profile_hash | ||
|
||
|
||
class TestFailedPartialParse(unittest.TestCase): | ||
@patch("dbt.tracking.track_partial_parser") | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like
credentials._connection_keys()
is just the set of names of credential keys, e.g:If we hash just the key names without the values, then partial parsing won't retrigger even if one of the values changes, as it should. We should use
list(config.credentials.credential_info())
instead.with_aliases=False
looks appropriate here as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! This also mean I probably should add an integration test to capture the behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You beat me to my suggestion on tests 😂