Skip to content
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

Redact values from logs due 'duplicate key' error #773

Merged

Conversation

jaypeedevlin
Copy link
Contributor

@jaypeedevlin jaypeedevlin commented Sep 14, 2023

resolves #772
Docs N/A

Assuming this is merged, it would be amazing if this could be backported into 1.6.x so we can take advantage in our org without having to go through a minor version upgrade (which there's a lot of work involved given our scale)

Problem

We are leaking raw data into logs in certain cases.

Solution

Copies the method that exists, placing code into a loop to handle any other future cases that may arise.

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in CI and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX

@cla-bot cla-bot bot added the cla:yes label Sep 14, 2023
@jaypeedevlin jaypeedevlin changed the title Jaypeedevlin redact values Redact values from logs due 'duplicate key' error Sep 14, 2023
@jaypeedevlin jaypeedevlin marked this pull request as ready for review September 14, 2023 05:13
@jaypeedevlin jaypeedevlin requested a review from a team as a code owner September 14, 2023 05:13
@dataders dataders closed this Sep 14, 2023
@dataders dataders reopened this Sep 14, 2023
Copy link
Contributor

@dbeatty10 dbeatty10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaypeedevlin thanks for raising this PR 🤩 !

Three things to get this passing CI:

  1. Code suggestion to expect dbt run to fail when it raises the error
  2. Code suggestion to apply the expected code format
  3. Add a changelog entry via changie new

Just let @dataders or myself if you want an assist with any of the above.

@jaypeedevlin
Copy link
Contributor Author

@dbeatty10 thanks for the review — I believe this should now be good to go. Assuming the merge goes through if there's any possibility to get this backported to 1.6.x that would be a massive help for us!

@dataders dataders requested a review from dbeatty10 September 15, 2023 13:17
@dbeatty10 dbeatty10 added the ready_for_review Externally contributed PR has functional approval, ready for code review from Core engineering label Sep 15, 2023
@mikealfare mikealfare self-assigned this Sep 15, 2023
Copy link
Contributor

@mikealfare mikealfare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @jaypeedevlin! I just had two suggestions, otherwise I like the approach.

@colin-rogers-dbt colin-rogers-dbt merged commit 9fa8de2 into dbt-labs:main Sep 18, 2023
dataders pushed a commit that referenced this pull request Sep 19, 2023
* Add failing test

* Fix model test naming

* Add redaction looping logic

* Apply suggestions from code review

Co-authored-by: Doug Beatty <[email protected]>

* Add changelog

* Fix test case

* Rename test class

* Colocate redaction tests

* Ignore if dbt run passes or fails

* Materialize as a table instead of a view to trigger an error

* Expect the run to fail with a specific error message

* Reverse order of dict, assert that sensitive data is replaced

* Add newline

---------

Co-authored-by: Doug Beatty <[email protected]>
Co-authored-by: Mike Alfare <[email protected]>
(cherry picked from commit 9fa8de2)
dataders pushed a commit that referenced this pull request Sep 19, 2023
* Add failing test

* Fix model test naming

* Add redaction looping logic

* Apply suggestions from code review

Co-authored-by: Doug Beatty <[email protected]>

* Add changelog

* Fix test case

* Rename test class

* Colocate redaction tests

* Ignore if dbt run passes or fails

* Materialize as a table instead of a view to trigger an error

* Expect the run to fail with a specific error message

* Reverse order of dict, assert that sensitive data is replaced

* Add newline

---------

Co-authored-by: Doug Beatty <[email protected]>
Co-authored-by: Mike Alfare <[email protected]>
(cherry picked from commit 9fa8de2)
McKnight-42 pushed a commit that referenced this pull request Sep 25, 2023
* Add failing test

* Fix model test naming

* Add redaction looping logic

* Apply suggestions from code review

Co-authored-by: Doug Beatty <[email protected]>

* Add changelog

* Fix test case

* Rename test class

* Colocate redaction tests

* Ignore if dbt run passes or fails

* Materialize as a table instead of a view to trigger an error

* Expect the run to fail with a specific error message

* Reverse order of dict, assert that sensitive data is replaced

* Add newline

---------

Co-authored-by: Doug Beatty <[email protected]>
Co-authored-by: Mike Alfare <[email protected]>
(cherry picked from commit 9fa8de2)

Co-authored-by: Josh Devlin <[email protected]>
McKnight-42 pushed a commit that referenced this pull request Sep 25, 2023
* Add failing test

* Fix model test naming

* Add redaction looping logic

* Apply suggestions from code review

Co-authored-by: Doug Beatty <[email protected]>

* Add changelog

* Fix test case

* Rename test class

* Colocate redaction tests

* Ignore if dbt run passes or fails

* Materialize as a table instead of a view to trigger an error

* Expect the run to fail with a specific error message

* Reverse order of dict, assert that sensitive data is replaced

* Add newline

---------

Co-authored-by: Doug Beatty <[email protected]>
Co-authored-by: Mike Alfare <[email protected]>
(cherry picked from commit 9fa8de2)

Co-authored-by: Josh Devlin <[email protected]>
philippe-boyd-maxa pushed a commit to maxa-ai/dbt-snowflake that referenced this pull request Nov 27, 2023
* Add failing test

* Fix model test naming

* Add redaction looping logic

* Apply suggestions from code review

Co-authored-by: Doug Beatty <[email protected]>

* Add changelog

* Fix test case

* Rename test class

* Colocate redaction tests

* Ignore if dbt run passes or fails

* Materialize as a table instead of a view to trigger an error

* Expect the run to fail with a specific error message

* Reverse order of dict, assert that sensitive data is replaced

* Add newline

---------

Co-authored-by: Doug Beatty <[email protected]>
Co-authored-by: Mike Alfare <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes ok to test ready_for_review Externally contributed PR has functional approval, ready for code review from Core engineering
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ADAP-886] [Feature] Redact raw data from Duplicate Field Key Error
5 participants