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

Upgrade/2.6.2 #2

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7cb1a07
on-run-end hook correction (#357)
poloaraujo Jun 15, 2023
358b3d0
parse_json({{ field }}, wide_number_mode=>'round') was added for the …
calkan-cue Jun 15, 2023
5e20a38
Add wide_number_mode to remaining BigQuery upload macros (#356)
tebesfinwo Jun 15, 2023
247615d
fix: Escape single quotes in invocation_args (#355)
adamantike Jun 15, 2023
8ad9142
removed the wide_number_mode from bigquery parts
calkan-cue Jun 20, 2023
2367b47
adding escape newline for bigquery executions
SPTKL Jun 20, 2023
b464e60
fix typo
SPTKL Jun 20, 2023
82dff2d
Merge branch 'main' into 361-escape-newline-bigquery-executions
SPTKL Jun 20, 2023
7789aca
Merge pull request #358 from calkan-cue/parse_json_fix_bq
jared-rimmer Jun 21, 2023
135b1d4
Merge pull request #362 from farmersdog/361-escape-newline-bigquery-e…
jared-rimmer Jun 21, 2023
ee91562
Fix BigQuery parse_json macro usage (#371)
glsdown Jul 21, 2023
fbe99f8
[RELEASE] Version 2.4.3 (#370)
glsdown Jul 24, 2023
8c8fbed
adding support for dbt v1.6 (#374)
sfc-gh-kumaurya Sep 11, 2023
8910738
Add CI checks for 1.6 (#378)
glsdown Sep 11, 2023
db1b9b1
Fix SQLFluff check on push to main (#379)
glsdown Sep 11, 2023
9fbca4f
Bump version number (#377)
glsdown Sep 11, 2023
62554f3
Add Python setup (#380)
glsdown Sep 11, 2023
cef1cec
Add escape for windows backslash on checksum columns (#353)
jared-rimmer Sep 13, 2023
532edbb
Add variable to allow users to exclude all results columns (#382)
glsdown Sep 18, 2023
7a33172
Improve insert method used (#381)
glsdown Sep 18, 2023
3bde046
Fix bug with calculation of last_run stats for incremental models (#384)
glsdown Sep 21, 2023
3cf1473
Fix missing value in upload model executions - add else clause to for…
kenpokiwi Sep 28, 2023
af2ed31
Update version number (#387)
glsdown Sep 28, 2023
069d71c
Add postgres support (#368)
dpguthrie Sep 29, 2023
039004a
Update get_column_name_lists.sql (#393)
il-dat Oct 3, 2023
5d2df3f
Tidy up execution timings logic (#389)
glsdown Oct 5, 2023
165945f
Update version numbers (#394)
glsdown Oct 5, 2023
deeec8b
Add support for 1.7 (#403)
glsdown Nov 16, 2023
4220a9c
Release v2.6.2 (#404)
glsdown Nov 16, 2023
dba2917
Fix: typo in upload_results to determine batch size
rtkfan Dec 1, 2023
2ee23c2
Copy model object to leave original intact
whiteh Dec 21, 2023
d71c39f
Update macros/upload_results/upload_results.sql
jared-rimmer Jan 25, 2024
486c5f6
Merge pull request #411 from rtkfan/fix-upload_results-typo
jared-rimmer Jan 25, 2024
07c8cfb
Merge branch 'main' into bug/raw_code-deleted-from-model
jared-rimmer Jan 25, 2024
b51347b
replace model for include all results
whiteh Jan 25, 2024
dff781b
replace model for include all results
whiteh Jan 25, 2024
81da1e4
Merge pull request #415 from whiteh/bug/raw_code-deleted-from-model
jared-rimmer Jan 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [ ] New features (breaking change)
- [ ] Other (non-breaking change)
- [ ] Other (breaking change)
- [ ] Release preparation

## What does this solve?

Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/ci_lint_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }} # Check out the code of the PR

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.9.x"
architecture: "x64"

- name: Install Python packages
run: python -m pip install dbt-snowflake~=1.5.0 sqlfluff-templater-dbt
run: python -m pip install dbt-snowflake~=1.7.0 sqlfluff-templater-dbt~=2.3.2

- name: Test database connection
run: dbt debug
Expand Down
34 changes: 30 additions & 4 deletions .github/workflows/ci_test_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ env:
DBT_ENV_SECRET_DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }}
DBT_ENV_SECRET_GCP_PROJECT: ${{ secrets.GCP_PROJECT }}
# Env var to test version
LAST_RELEASE_SUPPORTED_DBT_VERSION: 1_4_0 # A dbt version supported by both the last release and this one
LAST_RELEASE_SUPPORTED_DBT_VERSION: 1_7_0 # A dbt version supported by both the last release and this one
# Env vars to test invocations model
DBT_CLOUD_PROJECT_ID: 123
DBT_CLOUD_JOB_ID: ABC
Expand All @@ -37,14 +37,27 @@ jobs:
strategy:
fail-fast: false # Don't fail one DWH if the others fail
matrix:
warehouse: ["snowflake", "bigquery"]
warehouse: ["snowflake", "bigquery", "postgres"]
runs-on: ubuntu-latest
environment:
name: Approve Integration Tests
permissions:
contents: "read"
id-token: "write"

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Get latest release
uses: rez0n/actions-github-release@main
Expand Down Expand Up @@ -100,16 +113,29 @@ jobs:
strategy:
fail-fast: false # Don't fail one DWH if the others fail
matrix:
warehouse: ["snowflake", "bigquery"]
warehouse: ["snowflake", "bigquery", "postgres"]
# When supporting a new version, update the list here
version: ["1_3_0", "1_4_0", "1_5_0"]
version: ["1_3_0", "1_4_0", "1_5_0", "1_6_0", "1_7_0"]
runs-on: ubuntu-latest
environment:
name: Approve Integration Tests
permissions:
contents: "read"
id-token: "write"

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- uses: actions/setup-python@v4
with:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/main_lint_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ jobs:
- name: Checkout branch
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.9.x"
architecture: "x64"

- name: Install Python packages
run: python -m pip install dbt-snowflake~=1.5.0 sqlfluff-templater-dbt
run: python -m pip install dbt-snowflake~=1.7.0 sqlfluff-templater-dbt~=2.3.2

- name: Test database connection
run: dbt debug
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/main_test_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,26 @@ jobs:
integration:
strategy:
matrix:
warehouse: ["snowflake", "bigquery"]
version: ["1_3_0", "1_4_0", "1_5_0"]
warehouse: ["snowflake", "bigquery", "postgres"]
version: ["1_3_0", "1_4_0", "1_5_0", "1_6_0", "1_7_0"]
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_docs_on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: actions/checkout@v3

- name: Install Python packages
run: python -m pip install dbt-snowflake~=1.3.0
run: python -m pip install dbt-snowflake~=1.7.0

- name: Test database connection
run: dbt debug
Expand Down
63 changes: 36 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The package currently supports
- Spark :white_check_mark:
- Snowflake :white_check_mark:
- Google BigQuery :white_check_mark:
- Postgres :white_check_mark:

Models included:

Expand Down Expand Up @@ -45,7 +46,7 @@ See the generated [dbt docs site](https://brooklyn-data.github.io/dbt_artifacts/
```
packages:
- package: brooklyn-data/dbt_artifacts
version: 2.4.2
version: 2.6.2
```

:construction_worker: Make sure to fix at least the **minor** version, to avoid issues when a new release is open. See the notes on upgrading below for more detail.
Expand All @@ -55,15 +56,15 @@ packages:
3. Add an on-run-end hook to your `dbt_project.yml`

```yml
`on-run-end:
- "{{ dbt_artifacts.upload_results(results) }}"`
on-run-end:
- "{{ dbt_artifacts.upload_results(results) }}"
```

We recommend adding a conditional here so that the upload only occurs in your production environment, such as:

```yml
on-run-end:
- "{% if target.name == 'prod' %}{{ dbt_artifacts.upload_results(results) }}{% endif %}"`)
- "{% if target.name == 'prod' %}{{ dbt_artifacts.upload_results(results) }}{% endif %}"
```

4. Run the tables!
Expand Down Expand Up @@ -141,6 +142,37 @@ vars:
]
```

## Creating custom marts tables

Multiple modelled `dim` and `fct` models have been provided for ease of use, but we recognise that some use cases may require custom ones. To this end, you can disable all but the raw sources tables using the following in your `dbt_project.yml` file:

```yml
# dbt_project.yml

models:
dbt_artifacts:
+enabled: false
sources:
+enabled: true
```

In these sources tables, you will find a JSON column `all_results` which contains a JSON blob of the results object used, which you can use in your own analysis:

- exposures
- models
- seeds
- snapshots
- sources
- tests

This column can cause queries to become too long - particularly in BigQuery. Therefore, if you want to disable this column, you can make use of the `dbt_artifacts_exclude_all_results` variable, and set this to `true` in your `dbt_project.yml` file.

```
# dbt_project.yml
vars:
dbt_artifacts_exclude_all_results: true
```

## Upgrading from 1.x to >=2.0.0

If you were using the following variables:
Expand Down Expand Up @@ -189,29 +221,6 @@ An example operation is as follows:
dbt run-operation migrate_from_v0_to_v1 --args '{old_database: analytics, old_schema: dbt_artifacts, new_database: analytics, new_schema: artifact_sources}'
```

## Creating custom marts tables

Multiple modelled `dim` and `fct` models have been provided for ease of use, but we recognise that some use cases may require custom ones. To this end, you can disable all but the raw sources tables using the following in your `dbt_project.yml` file:

```yml
# dbt_project.yml

models:
dbt_artifacts:
+enabled: false
sources:
+enabled: true
```

In these sources tables, you will find a JSON column `all_results` which contains a JSON blob of the results object used, which you can use in your own analysis:

- exposures
- models
- seeds
- snapshots
- sources
- tests

## Acknowledgements

Thank you to [Tails.com](https://tails.com/gb/careers/) for initial development and maintenance of this package. On 2021/12/20, the repository was transferred from the Tails.com GitHub organization to Brooklyn Data Co.
Expand Down
4 changes: 2 additions & 2 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "dbt_artifacts"
version: "2.4.2"
version: "2.6.2"
config-version: 2
require-dbt-version: [">=1.3.0", "<1.6.0"]
require-dbt-version: [">=1.3.0", "<1.8.0"]
profile: "dbt_artifacts"

clean-targets: # folders to be removed by `dbt clean`
Expand Down
1 change: 1 addition & 0 deletions integration_test_project/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ vars:
env_vars:
["TEST_ENV_VAR_NUMBER", "TEST_ENV_VAR_EMPTY", "TEST_ENV_VAR_WITH_QUOTE"]
dbt_vars: ["test_dbt_vars_1", "test_dbt_vars_2", "test_dbt_vars_3"]
dbt_artifacts_exclude_all_results: true

models:
+persist_docs:
Expand Down
1 change: 1 addition & 0 deletions integration_test_project/example-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export DBT_ENV_SPARK_DRIVER_PATH= # /Library/simba/spark/lib/libsparkodbc_sbu.dy
export DBT_ENV_SPARK_ENDPOINT= # The endpoint ID from the Databricks HTTP path

# dbt environment variables, change these
export DBT_VERSION="1_5_0"
export DBT_CLOUD_PROJECT_ID=
export DBT_CLOUD_JOB_ID=
export DBT_CLOUD_RUN_ID=
Expand Down
13 changes: 11 additions & 2 deletions integration_test_project/profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# You should __NEVER__ check credentials into version control. Thanks for reading :)

config:
send_anonymous_usage_stats: False
use_colors: True
send_anonymous_usage_stats: False
use_colors: True

dbt_artifacts:
target: snowflake
Expand Down Expand Up @@ -43,3 +43,12 @@ dbt_artifacts:
timeout_seconds: 300
priority: interactive
retries: 1
postgres:
type: postgres
host: localhost
user: postgres
password: postgres
port: 5432
dbname: postgres
schema: public
threads: 8
2 changes: 1 addition & 1 deletion integration_test_project/tests/singular_test.sql
Original file line number Diff line number Diff line change
@@ -1 +1 @@
select 1 as failures from (select 2) where 1 = 2
select 1 as failures from (select 2) as foo where 1 = 2
Loading
Loading