-
Notifications
You must be signed in to change notification settings - Fork 489
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
Add option to ignore columns in equality test #737
Add option to ignore columns in equality test #737
Conversation
Co-authored-by: deanna-minnick <[email protected]>
Thanks @brunocostalopes - seems like something odd is happening with the CI, I'll have to look into that! Code itself looks good though 🎉 |
Hello! Nice, would love this feature! Just a suggestion: don't you think you could remove the elements from for column in ignore_columns: So it would use only existing objects and loop only on ignore_columns elements (which schould be fewer than compare_columns ones) . |
@moreaupascal56 thanks for the tip. I think you are right. If we remove instead of append it makes the code neater and I've pushed those changes. I've also tried your other suggestion of looping through the elements in the ignore list first but that would make the code a bit more complex when removing from the original compare list so I've decided against it as I don't think the potential performance gains would be that relevant here. @joellabes seems like the checks are passing again, thank you for looking into it. I think the PR is now ready for your review. |
Excited to see this come through - have been running into a need for this during legacy code conversion. |
@joellabes @deanna-minnick Can this PR get reviewed and approved? I'd love to have this feature available. |
I've just realised that the latest change I've pushed has a bug which I can't explain. This is the code with the issue:
whenever a match is found and a column is removed from I can't understand why this is happening. If anyone has a clue please let me know, I would be happy to fix. In the meantime, I'm going to revert back to the previous version which, even thought it is not the tidiest implementation, it seems to work well. |
This reverts commit 4112453.
I believe @moreaupascal56's suggestion was that you wouldn't loop over compare_columns anyway. Why not try it like this? Should avoid the bug you're seeing and be a faster loop anyway.
|
Thanks for the suggestion @pauldalewilliams. I've tried your suggestion but I don't think it works without adding more complexity to handle the different upper/lower case scenarios. I think I prefer the current solution. @joellabes is there still interest in adding this feature? If so, anything else I can do to help merging? Happy to take any additional suggestions on board and make the necessary changes. |
This PR has been marked as Stale because it has been open with no activity as of late. If you would like the PR to remain open, please comment on the PR or else it will be closed in 7 days. |
Although we are closing this PR as stale, it can still be reopened to continue development. Just add a comment to notify the maintainers. |
resolves #734
This is a:
All pull requests from community contributors should target the
main
branch (default).Description & motivation
This is to include an option to ignore columns in the equality test. Currently the only way to do this is to use the
compare_columns
option and include all columns we want to compare, leaving out any that we want to exclude. In certain cases this might result in large yml files, difficult to maintain. Theignore_columns
option fixes that.Checklist
star()
source)limit_zero()
macro in place of the literal string:limit 0
dbt.type_*
macros instead of explicit datatypes (e.g.dbt.type_timestamp()
instead ofTIMESTAMP