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

Multi-field surrogate key failing due to using default dbt_utils concat macro #62

Closed
chiblackhawks opened this issue Oct 5, 2021 · 3 comments

Comments

@chiblackhawks
Copy link

Hi,

I noticed while using surrogate_key that the compiled sql was syntactically incorrect due to the operator used to concat the list of fields I am passing to the macro. After some triage, I realized that it was using the default dbt_utils.concat() macro which uses '||' to concat.

In order to resolve this, I added the following to my dbt_project.yml:

dispatch:
  - macro_namespace: dbt_utils
    search_order: ['tsql_utils', 'dbt_utils']

vars:
  dbt_utils_dispatch_list: ['tsql_utils']
  dbt_date_dispatch_list: ['tsql_utils']
  audit_helper_dispatch_list: ['tsql_utils']
  dbt_expectations_dispatch_list: ['tsql_utils']

This solved the issue but I am not confident that this is the correct solution?

@dataders
Copy link
Contributor

dataders commented Oct 5, 2021

this is related to #52, which is a change as part of dbt 0.20.0. are you by chance using that version of dbt-sqlserver or dbt-synapse? If so, my apologies, I still have to update the docs to reflect those changes. It sounds, as if you've figured it out now though?

@chiblackhawks
Copy link
Author

Sorry to have overlooked the original ticket. I am using the dbt-sqlserver package and was able to get it figured out by noticing the new dispatch method on the DBT docs page https://docs.getdbt.com/reference/dbt-jinja-functions/dispatch.

I am still getting set in a new role and am unsure how much longer we will be using Azure SQL - but if it appears to be a longer term architecture for us, I will gladly help out with anything in this repo.

Thanks for the quick response!

@dataders
Copy link
Contributor

dataders commented Oct 5, 2021

@chiblackhawks this week I'll be updating this repo, there's a number of pending changes that users are asking of. thanks for opening the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants