-
Notifications
You must be signed in to change notification settings - Fork 27
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
enablement due to dbt-utils' "dispatchifiction" #17
Conversation
@jtcohen6 any idea as to how we can tackle these tests? Maybe wrap the majority of logic into standalone macros that we can write our own versions of? |
@swanderz We could abstract those in |
sure, though i'm leery of the size of that PR, so maybe in a follow-on 🤷 ? |
Feels closely related, and that PR isn't too big (talking about "t-sql hacks that shouldn't break mainline behavior," not "dispatch-ify ALL THE MACROS!") |
Could I be really boring and request:
|
done. and done. |
@mikaelene what do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @swanderz ,
This all looks really good. I haven't marked last 4 (test files) as 'viewed' as I didn't fully understand them as I haven't worked with those macros. But I definitely think this is all good to pull in.
@@ -1,5 +1,5 @@ | |||
{% macro sqlserver__hash(field) %} | |||
hashbytes('md5', {{field}}) | |||
convert(varchar(50), hashbytes('md5', {{field}}), 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@swanderz just noting that this will limit hashable field size to 50 (bytes not chars I think). Is this intended behaviour? Could use string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at this as well. I had the same in the old sqlserver-utils package. Maybe we can have varchar(max)? Most cases will be hashing one column, but if you want to look for diffs, like watching for changes, you may include a lot of columns making the hashes longer then 50
@@ -1,3 +1,4 @@ | |||
[submodule "dbt-utils"] | |||
path = dbt-utils | |||
url = https://github.com/fishtown-analytics/dbt-utils | |||
branch = master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting this may result in changes in dbt-utils breaking things on our side without an explicit commit as not pegged to a certain version.
You might consider adding some docstrings to the tests to help others (and yourself when you forget what you did) to understand them as I think they're quite complex to reason about if looking at from fresh |
I think this looks great on an overall level. Don't have time to go through all but really great work! |
Some context about the bottom 3 The challenge is that some arguments defined in schema tests for some testing models in TL;DR the changes are just to make the integration testing work, and shouldn't ever affect end users unless I'm missing something |
With the two PRs below, we can now do the following two things:
support as many macros as we can.
as of now, all 39 of dbt-utils's macros are fully working except for the 15 listed below:
sql/groupby.sql
(will never be supported)insert_by_period
materializationdate_spine
test_mutually_exclusive_ranges()
Port test_mutually_exclusive_ranges() to TSQL #18url
macros (get_url_host
,get_url_path
,get_url_host()
port theget_url_*()
macros #21generate_series()
get_relations_by_pattern()
get_relations_by_prefix_and_union()
union_relations()
additionally the following macros work on Azure SQL & SQL Server, but due to a synapse bug are disabled, because the ITs don't work.
dateadd()
datediff()
split_part()
last_day()
test-hash()
dbt-utils
's integration testingThe goal of getting this repo working with dbt-utils' integration testing was to make it very easy to:
One challenge with using dbt-utils' integration testing was that it is a bit of a RepRap in that it includes tests (schema and data) that are needed to evaluate whether the other macros are working. So in some cases, a macro works in TSQL with only a small change, but we had to disable the model corresponding to the macro in the
dbt_project.yml
anyway because there are tests used on the macro that weren't compatible with TSQL.dependent, now-merged PRs: