-
Notifications
You must be signed in to change notification settings - Fork 506
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
dbt v1 compat #453
Merged
Merged
dbt v1 compat #453
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b42e6f9
dbt 0.7.4 release (#441)
joellabes 77f537b
Merge branch 'main' into next/patch
joellabes 8b38a56
Regression: Correctly handle missing relations in get_column_values (…
joellabes 0859537
Add missing curlies
joellabes 0df84c3
what person wrote this code :/ (it was me)
joellabes 68b187f
wrap values in quotes
joellabes ef240c7
GOOD
joellabes 614a8fc
bigquery compat (they don't like except)
joellabes fd8dc17
Backport android url changes from #426 (#452)
joellabes db8a047
Update CHANGELOG.md
joellabes f367880
Merge branch 'main' into next/minor
joellabes f6b4e4c
Change require-dbt-version, update dbt_project.yml for integration te…
joellabes a5a0b2f
Upgrade python version in CI, improve drop relation integration test
joellabes 3cb69fb
Clarify version pinning
joellabes 77411a9
Drop support for release candidates of 1.0.0
joellabes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
name: 'dbt_utils' | ||
version: '0.7.0' | ||
version: '0.1.0' | ||
|
||
require-dbt-version: [">=0.20.0", "<=1.0.0"] | ||
require-dbt-version: [">=1.0.0-rc", "<2.0.0"] | ||
|
||
config-version: 2 | ||
|
||
target-path: "target" | ||
clean-targets: ["target", "dbt_modules"] | ||
clean-targets: ["target", "dbt_modules", "dbt_packages"] | ||
macro-paths: ["macros"] | ||
log-path: "logs" |
12 changes: 12 additions & 0 deletions
12
integration_tests/data/sql/data_get_column_values_dropped.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
field | ||
a | ||
b | ||
c | ||
d | ||
e | ||
f | ||
g | ||
g | ||
g | ||
g | ||
g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,16 +8,17 @@ profile: 'integration_tests' | |
|
||
config-version: 2 | ||
|
||
source-paths: ["models"] | ||
model-paths: ["models"] | ||
analysis-paths: ["analysis"] | ||
test-paths: ["tests"] | ||
data-paths: ["data"] | ||
seed-paths: ["data"] | ||
macro-paths: ["macros"] | ||
|
||
target-path: "target" # directory which will store compiled SQL files | ||
clean-targets: # directories to be removed by `dbt clean` | ||
- "target" | ||
- "dbt_modules" | ||
- "dbt_packages" | ||
|
||
dispatch: | ||
- macro_namespace: 'dbt_utils' | ||
|
@@ -54,6 +55,12 @@ seeds: | |
sql: | ||
data_events_20180103: | ||
+schema: events | ||
|
||
data_get_column_values_dropped: | ||
# TODO: Ideally this would use the adapter, but it gives a "Tried to drop relation, but its type is null" error. | ||
#+post-hook: "{% do adapter.drop_relation(this) %}" | ||
+post-hook: "drop table {{ this }}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you know that this is a table, you could try something like (pseudo-code): +post-hook: "{% do adapter.drop_relation(this.incorporate(type='table')) %}" |
||
|
||
|
||
schema_tests: | ||
data_test_sequential_timestamps: | ||
|
26 changes: 26 additions & 0 deletions
26
integration_tests/tests/sql/test_get_column_values_use_default.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
{% set column_values = dbt_utils.get_column_values(ref('data_get_column_values_dropped'), 'field', default=['y', 'z'], order_by="field") %} | ||
|
||
with expected as ( | ||
select {{ dbt_utils.safe_cast("'y'", dbt_utils.type_string()) }} as expected_column_value union all | ||
select {{ dbt_utils.safe_cast("'z'", dbt_utils.type_string()) }} as expected_column_value | ||
), | ||
|
||
actual as ( | ||
|
||
{% for val in column_values %} | ||
select {{ dbt_utils.safe_cast("'" ~ val ~ "'", dbt_utils.type_string()) }} as actual_column_value | ||
{% if not loop.last %} | ||
union all | ||
{% endif %} | ||
{% endfor %} | ||
), | ||
|
||
failures as ( | ||
select * from actual | ||
where actual.actual_column_value not in ( | ||
select expected.expected_column_value from expected | ||
) | ||
) | ||
|
||
select * from failures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
What do you think about switching this to
[">=1.0.0", "<2.0.0"]
once we have a final release of dbt-core v1.0.0? In which case, this feels fine for nowThere 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.
Yeah I don't really want to have to release 0.8.1 in a week that just drops the release candidates. Since
I think I'm happy to say that 0.8 is only going to cover the final released version of 1.0
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.
With that said, that means that when I merge this in, Circle CI will give it a ❌ until 1.0 final actually ships. Do we feel OK about that? (cc @jasnonaz)
keeping in mind that there are like a dozen packages that will all need changed, so I really don't wanna do that twice