-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add update_type and rowcount to dbt commands SQL status in CLI output
- Loading branch information
1 parent
a8f4a98
commit 6b6f60a
Showing
3 changed files
with
77 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kind: Features | ||
body: Added update_type and rowcount to dbt commands SQL status in CLI output | ||
time: 2024-08-12T16:16:25.330055+02:00 | ||
custom: | ||
Author: damian3031 | ||
Issue: "428" | ||
PR: "429" |
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import pytest | ||
from dbt.tests.util import run_dbt, run_dbt_and_capture | ||
|
||
seed_csv = """ | ||
id,name,some_date | ||
1,Easton,1981-05-20 06:46:51 | ||
2,Lillian,1978-09-03 18:10:33 | ||
3,Jeremiah,1982-03-11 03:59:51 | ||
4,Nolan,1976-05-06 20:21:35 | ||
""".lstrip() | ||
|
||
model_sql = """ | ||
select * from {{ ref('seed') }} | ||
""" | ||
|
||
|
||
class TestSqlStatusOutput: | ||
""" | ||
Testing if SQL status output contains update_type and rowcount | ||
""" | ||
|
||
@pytest.fixture(scope="class") | ||
def seeds(self): | ||
return { | ||
"seed.csv": seed_csv, | ||
} | ||
|
||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return { | ||
"materialization_table.sql": model_sql, | ||
"materialization_view.sql": model_sql, | ||
} | ||
|
||
@pytest.fixture(scope="class") | ||
def project_config_update(self): | ||
return { | ||
"name": "sql_status_output", | ||
"models": { | ||
"sql_status_output": { | ||
"materialization_table": {"+materialized": "table"}, | ||
"materialization_view": {"+materialized": "view"}, | ||
} | ||
}, | ||
} | ||
|
||
def test_run_seed_test(self, project): | ||
results = run_dbt(["seed"], expect_pass=True) | ||
assert len(results) == 1 | ||
|
||
results, logs = run_dbt_and_capture(["--no-use-colors", "run"], expect_pass=True) | ||
assert len(results) == 2 | ||
assert ( | ||
f" of 2 OK created sql table model {project.test_schema}.materialization_table [CREATE TABLE (4 rows) in " | ||
in logs | ||
) | ||
assert ( | ||
f" of 2 OK created sql view model {project.test_schema}.materialization_view [CREATE VIEW in " | ||
in logs | ||
) |