Adding column data types to cleanup_exceptions #7
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.
Important
Don't expose any internal or business critical information to this public repository!
Why?
When building a project with the dna_public_dbt_macros package installed, a cleanup_exceptions table is built with all columns given the data type 'NUMBER(38,0)'.
If a user later wants to use the cleanup_exceptions, the build will fail with the following error:
We tried to use the cleanup_exceptions in the Tech Buying project, to clean up tables without deleting a view created outside dbt.
We were unable to build the cleanup_exceptions until we dropped the existing table.
What?
The added code sets the column types to varchar, in order to avoid the above error.
This fix will work for projects that do not already have the dna_public_dbt_macros package installed.
Test
I have tested the changes.
If the table is not already built, it will be built with the correct data types.
If the table is built with the wrong data types, nothing will happen.
Breaking Change?
N
The project will build without problems.
PLEASE NOTE:
If cleanup_exceptions values are added in a project with an existing empty cleanup_exceptions table of the current version, the build will fail. The existing cleanup_exceptions will then need to be dropped, before the project will build.
If an empty cleanup_exceptions table of the current version does not exist in the project, this change will make sure that an empty table is built with the correct data types, so it will be usable when needed.
I have not been able to change the data types, without dropping the existing table - Is it possible?