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

Function to double quote (or custom character) surround all column names (sat and mas macros) #91

Merged
merged 55 commits into from
Jan 5, 2022

Conversation

DVTimWilson
Copy link
Contributor

Provide function to double quote (or custom character) surround all column names in compiled SQL code,
now working with sat and mas macros.

Pull request 89
Issue 23
Issue 28
AB#1981

Tim Wilson and others added 30 commits May 27, 2021 15:54
Also an example of usage in the eff_sat.sql macro
- Currently the framework doesn't allow unusual column names to pass through
- The data for the unittests need to be updated 
- The associated test .sql files that call the macro for each of the unittest need to be created too
- Added a new test for when the "columns" parameter is an empty string
- Reformatted the macro; now it uses dbtvault.is_something() to check if "columns" is not empty
Copy link
Member

@DVAlexHiggs DVAlexHiggs left a comment

Choose a reason for hiding this comment

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

Looks great. Really like how this has been implemented. Thank you!

@DVAlexHiggs DVAlexHiggs merged commit 46a451b into develop Jan 5, 2022
@DVAlexHiggs DVAlexHiggs deleted the feat/escape-col-name branch January 5, 2022 16:24
DVAlexHiggs added a commit that referenced this pull request Dec 17, 2022
…mes (sat and mas macros) (#91)

* Macro to escape column names (Norbert's code)

Also an example of usage in the eff_sat.sql macro

* Example of usage in the eff_sat.sql macro

* WIP: Added new sat fixture tables + new test for the escape column macro

- Currently the framework doesn't allow unusual column names to pass through

* Created a unittest file for the escape_col_name macro

- The data for the unittests need to be updated 
- The associated test .sql files that call the macro for each of the unittest need to be created too

* WIP: Added new tests + their files

* Added more tests for escape_column_name macro

* Extended test coverage for escape_column_name macro + minor reformatting

- Added a new test for when the "columns" parameter is an empty string
- Reformatted the macro; now it uses dbtvault.is_something() to check if "columns" is not empty

* submod

* Move example usage to eff_sat_escape_col_name.sql

* Fix for dirty status

* Move example fixture into fixtures_sat.py

* Removed submodule dbtvault-docs

* WIP update unit tests

AB#1981

* Update unit tests and increase test coverage

* More unit tests

AB#1981

* Updated unit tests for escape_column_name() macro

AB#1981

* Updated unit tests for escape_column_name() macro

AB#1981

* Formatting tidy up

* Centralise processing for CONCAT() / CONCAT_WS()

* Fix for processing of test scenario staging rank column lists

* Apply escape_column_name() macro to hub, link, t_link, xts

AB#1981

* Apply escape_column_name() macro to stage macro

AB#1981

* Column name protection for period and rank load

AB#1981

* Testing the stage macro with a 'bad' column name

AB#1981

* Bug fix

AB#1981

* Update sat macro

AB#1981

* Update eff sat macro

AB#1981

* Update ma sat macro

AB#1981

* Testing stage macro again

AB#1981

* Updated fixture for stage testing

AB#1981

* Minor

* Updated fixture for stage testing

AB#1981

* Update pit and bridge macros

AB#1981

* Delete obsolete fixture

* PR issue: missing fixtures and tests

* PR issue: update unit tests' expected data with escaped column names

* PR issue: update unit tests' expected data with escaped column names

* Bug fix for PR failure

* Resolve issues with dictionary style hashdiff column metadata

Additional unit tests, update escape_column_name and sat macros

* Rename macro as escape_column_names(columns)

To allow for internal macro escape_column_name(column)

* Tidy up after merge branch 'develop'

Co-authored-by: Tim Wilson <tim-wilson@data-vault.com>
Co-authored-by: Norbert Acatrinei <norbert.acatrinei@business-thinking.com>
Co-authored-by: Alex Higgs <alex.higgs@data-vault.co.uk>
Co-authored-by: Alex Higgs <alex.higgs@data-vault.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants