Skip to content

Commit eb12922

Browse files
joellabesdeanna-minnickelyoboalexmalinszachoj10
authored
dbt utils v1.0.0-rc1 (#733)
* add safe_divide documentation * add safe_divide macro * add integration test for safe_divide macro * Merge changes from main into utils v1 (#699) * Correct link from README to the CONTRIBUTING guide. (#687) * fix typo (#688) Co-authored-by: Alex Malins <22991362+alexmalins@users.noreply.github.com> * Change `escape_single_quotes` Reference in Pivot Macro (#692) * Update pivot.sql * Changelog Updates Co-authored-by: Liam O'Boyle <github@elyobo.net> Co-authored-by: Alex Malins <github@alexmalins.com> Co-authored-by: Alex Malins <22991362+alexmalins@users.noreply.github.com> Co-authored-by: zachoj10 <zjosephson@gmail.com> * Use backwards comaptible versions of timestamp macro * moved macro and documentation to new SQL generator section * add tests with expressions * fix syntax errors (#705) * fix syntax errors * remove whitespace in seed file * Restore dbt. prefix for all migrated cross-db macros (#701) * added prefix dbt. on cross db macros * Also prefix for new macro * Adding changelog change * Squashed commit of the following: commit 5eba82b Author: Deanna Minnick <deanna.e.minnick@gmail.com> Date: Wed Oct 12 10:30:42 2022 -0400 remove whitespace in seed file commit 7a2a5e3 Author: Deanna Minnick <deanna.e.minnick@gmail.com> Date: Wed Oct 12 10:22:07 2022 -0400 fix syntax errors Co-authored-by: Joel Labes <joel.labes@dbtlabs.com> * Remove obsolete condition argument from expression_is_true (#700) * Remove obsolete condition argument from expression_is_true * Improve docs * Improve docs * Update star.sql to allow for non-quote wrapped column names (#706) * Update star.sql * Update star.sql * feat: add testing to star macro column encased in quotes functionality * chore: update schema.yml * Update star.sql * chore: update star.sql and schema.yml * chore: update star.sql to trim blank space * Update README.md * Update README.md adds example usage of star macro's quote_identifiers argument Co-authored-by: crlough <connor.lough@pitchbook.com> * Switch to dbt.escape_single_quotes * Change deprecation resolution advice * Wrap xdb warnings in if execute block * Slugify for snowflake (#707) * Merge main into utils-v1 (#726) * Feature/safe divide (#697) * add safe_divide documentation * add safe_divide macro * add integration test for safe_divide macro * moved macro and documentation to new SQL generator section Co-authored-by: Grace Goheen <graciegoheen@gmail.com> * Revert "Feature/safe divide (#697)" (#702) This reverts commit f368cec. * Quick nitpicks (#718) I was doing some studying on these and spotted some stuff. One verb conjugation and a consistency in macro description Co-authored-by: deanna-minnick <41010575+deanna-minnick@users.noreply.github.com> Co-authored-by: Grace Goheen <graciegoheen@gmail.com> Co-authored-by: ian-fahey-dbt <107962364+ian-fahey-dbt@users.noreply.github.com> * Feat: add macro get_query_results_as_single_value (#696) * feat: add query_results_as_single_value.sql macro * chore: update the macro definition Current error to work through: "failed to find conversion function from unknown to text" * chore: update test * chore: final edits * chore: remove extra model reference * chore: update return() to handle BigQuery * chore: README.md, macro updates * feat: factoring in first review changes * chore: updates to testing * chore: updates tests * chore: update test for bigquery * chore: update cast for bigquery * Use example with a single record in readme * Add default value when no record found * test when no results are found * Rename test file * Add test definitions * Fix incorrect ref * And another one * Update test_get_query_results_as_single_value.sql * cast strings as strings * Put arg in right place * Update test_get_query_results_as_single_value.sql * switch to limit zero for BQ * Update test_get_query_results_as_single_value.sql * quote column name in arg * snowflake wont let you safe cast something to itself * warning to future readers [skip ci] * Add singular test to check for multi row/multi column setup * forgot to save comment [skip ci] * Rename to get_single_value Co-authored-by: crlough-gitkraken <loughondata@protonmail.com> Co-authored-by: Joel Labes <joel.labes@dbtlabs.com> * Remove rc1 requirement for utils v1 * Recency truncate date option (#731) * WIP changing recency test * Add tests * cast to timestamp for bq * forgot the curlies * avoid lateral column aliasing * ts not dt * cast source as timestamp * don't cast inside test * cast as date instead of truncate * Update recency.sql * log bq events * store pg artifacts * int tests dir * Correctly store artifacts * try casting to date or datetime * order of operations more like order of ooperations * dt -> ts * Do I really have to cast this? * Revert "Do I really have to cast this?" This reverts commit 21e2c0d. * Output a warning when star finds no columns, not '*' (#732) * Change star() behaviour when no columns returned * Code review: return a * in compile mode * README changes * Delete xdb_deprecation_warning.sql * Update README.md * Remove from ToC * Update toc * Fix surrogate key variable example Co-authored-by: Deanna Minnick <deanna.e.minnick@gmail.com> Co-authored-by: Liam O'Boyle <github@elyobo.net> Co-authored-by: Alex Malins <github@alexmalins.com> Co-authored-by: Alex Malins <22991362+alexmalins@users.noreply.github.com> Co-authored-by: zachoj10 <zjosephson@gmail.com> Co-authored-by: Grace Goheen <graciegoheen@gmail.com> Co-authored-by: deanna-minnick <41010575+deanna-minnick@users.noreply.github.com> Co-authored-by: Simon Quvang <sikri19@student.sdu.dk> Co-authored-by: miles <miles@bung.cc> Co-authored-by: Connor <61797492+CR-Lough@users.noreply.github.com> Co-authored-by: crlough <connor.lough@pitchbook.com> Co-authored-by: fivetran-catfritz <111930712+fivetran-catfritz@users.noreply.github.com> Co-authored-by: ian-fahey-dbt <107962364+ian-fahey-dbt@users.noreply.github.com> Co-authored-by: crlough-gitkraken <loughondata@protonmail.com>
1 parent 6d76641 commit eb12922

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+554
-386
lines changed

.circleci/config.yml

+13-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ jobs:
2323
name: "Run OG Tests - Postgres"
2424
command: ./run_test.sh postgres
2525
- store_artifacts:
26-
path: ./logs
26+
path: integration_tests/logs
27+
- store_artifacts:
28+
path: integration_tests/target
2729

2830
integration-redshift:
2931
docker:
@@ -35,7 +37,9 @@ jobs:
3537
name: "Run OG Tests - Redshift"
3638
command: ./run_test.sh redshift
3739
- store_artifacts:
38-
path: ./logs
40+
path: integration_tests/logs
41+
- store_artifacts:
42+
path: integration_tests/target
3943

4044
integration-snowflake:
4145
docker:
@@ -47,8 +51,10 @@ jobs:
4751
name: "Run OG Tests - Snowflake"
4852
command: ./run_test.sh snowflake
4953
- store_artifacts:
50-
path: ./logs
51-
54+
path: integration_tests/logs
55+
- store_artifacts:
56+
path: integration_tests/target
57+
5258
integration-bigquery:
5359
environment:
5460
BIGQUERY_SERVICE_KEY_PATH: "/home/circleci/bigquery-service-key.json"
@@ -64,7 +70,9 @@ jobs:
6470
name: "Run OG Tests - BigQuery"
6571
command: ./run_test.sh bigquery
6672
- store_artifacts:
67-
path: ./logs
73+
path: integration_tests/logs
74+
- store_artifacts:
75+
path: integration_tests/target
6876

6977
workflows:
7078
version: 2

CHANGELOG.md

+39-3
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,66 @@
1111
# Unreleased
1212

1313
## New features
14+
- Updated the `slugify` macro to prepend "_" to column names beginning with a number since most databases do not allow names to begin with numbers.
1415
- Implemented an optional `group_by_columns` argument across many of the generic testing macros to test for properties that only pertain to group-level or are can be more rigorously conducted at the group level. Property available in `recency`, `at_least_one`, `equal_row_count`, `fewer_rows_than`, `not_constant`, `not_null_proportion`, and `sequential` tests [#633](https://github.com/dbt-labs/dbt-utils/pull/633)
1516
- New feature to omit the `source_column_name` column on the `union_relations` macro ([#331](https://github.com/dbt-labs/dbt-utils/issues/331), [#624](https://github.com/dbt-labs/dbt-utils/pull/624))
17+
- New macro `get_single_value` ([#696](https://github.com/dbt-labs/dbt-utils/pull/696))
1618
- New feature to select fewer columns in `expression_is_true` ([#683](https://github.com/dbt-labs/dbt-utils/issues/683), [#686](https://github.com/dbt-labs/dbt-utils/pull/686))
1719
- Add `not_empty_string` generic test that asserts column values are not an empty string. ([#632](https://github.com/dbt-labs/dbt-utils/issues/632), [#634](https://github.com/dbt-labs/dbt-utils/pull/634))
1820

1921
## Under the hood
20-
- Remove deprecated table argument from unpivot ([#671](https://github.com/dbt-labs/dbt-utils/pull/671))
22+
- Remove deprecated table argument from `unpivot` ([#671](https://github.com/dbt-labs/dbt-utils/pull/671))
2123
- Delete the deprecated identifier macro ([#672](https://github.com/dbt-labs/dbt-utils/pull/672))
2224
- Handle deprecations in deduplicate macro ([#673](https://github.com/dbt-labs/dbt-utils/pull/673))
23-
- Fully remove varargs usage in surrogate_key and safe_add ([#674](https://github.com/dbt-labs/dbt-utils/pull/674))
25+
- Fully remove varargs usage in `surrogate_key` and `safe_add` ([#674](https://github.com/dbt-labs/dbt-utils/pull/674))
26+
- Remove obsolete condition argument from `expression_is_true` ([#699](https://github.com/dbt-labs/dbt-utils/pull/699))
27+
28+
## Migration instructions
29+
- If your project uses the `expression_is_true` macro, replace `condition` argument with `where`.
30+
31+
Before:
32+
```yaml
33+
version: 2
34+
35+
models:
36+
- name: model_name
37+
tests:
38+
- dbt_utils.expression_is_true:
39+
expression: "col_a + col_b = total"
40+
condition: "created_at > '2018-12-31'"
41+
```
42+
After:
43+
```yaml
44+
version: 2
45+
46+
models:
47+
- name: model_name
48+
tests:
49+
- dbt_utils.expression_is_true:
50+
expression: "col_a + col_b = total"
51+
config:
52+
where: "created_at > '2018-12-31'"
53+
```
2454
2555
## Fixes
56+
- Add star macro option to not encase column names in quotes. ([#706](https://github.com/dbt-labs/dbt-utils/pull/706))
57+
- Explicitly stating the namespace for cross-db macros so that the dispatch logic works correctly by restoring the dbt. prefix for all migrated cross-db macros ([#701](https://github.com/dbt-labs/dbt-utils/pull/701))
2658
- Better handling of whitespaces in the star macro ([#651](https://github.com/dbt-labs/dbt-utils/pull/651))
2759
- Fix to correct behavior in `mutually_exclusive_ranges` test in certain situations when `zero_length_range_allowed: true` and multiple ranges in a partition have the same value for `lower_bound_column`. ([[#659](https://github.com/dbt-labs/dbt-utils/issues/659)], [#660](https://github.com/dbt-labs/dbt-utils/pull/660))
2860
- Fix to utilize dbt Core version of `escape_single_quotes` instead of version from dbt Utils ([[#689](https://github.com/dbt-labs/dbt-utils/issues/689)], [#692](https://github.com/dbt-labs/dbt-utils/pull/692))
2961

3062
## Contributors:
63+
- [@CR-Lough] (https://github.com/CR-Lough) (#706) (#696)
64+
- [@fivetran-catfritz](https://github.com/fivetran-catfritz)
65+
- [@crowemi](https://github.com/crowemi)
66+
- [@SimonQuvang](https://github.com/SimonQuvang) (#701)
3167
- [@christineberger](https://github.com/christineberger) (#624)
3268
- [@epapineau](https://github.com/epapineau) (#634)
3369
- [@courentin](https://github.com/courentin) (#651)
3470
- [@sfc-gh-ancoleman](https://github.com/sfc-gh-ancoleman) (#660)
3571
- [@zachoj10](https://github.com/zachoj10) (#692)
3672
- [@miles170](https://github.com/miles170)
37-
- [@emilyriederer](https://github.com/emilyriederer)
73+
- [@emilyriederer](https://github.com/emilyriederer)
3874

3975
# dbt-utils v0.8.6
4076

0 commit comments

Comments
 (0)