-
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.
Get 'properties' config inside 'properties' function. Add tests for t…
…able properties
- Loading branch information
1 parent
5e50f93
commit 1214e37
Showing
3 changed files
with
57 additions
and
10 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
3 changes: 1 addition & 2 deletions
3
dbt/include/trino/macros/materializations/materialized_view.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
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,49 @@ | ||
import pytest | ||
from dbt.tests.util import run_dbt, run_dbt_and_capture | ||
|
||
from tests.functional.adapter.materialization.fixtures import model_sql, seed_csv | ||
|
||
|
||
class BaseTableProperties: | ||
# Everything that goes in the "seeds" directory | ||
@pytest.fixture(scope="class") | ||
def seeds(self): | ||
return { | ||
"seed.csv": seed_csv, | ||
} | ||
|
||
# Everything that goes in the "models" directory | ||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return { | ||
"model.sql": model_sql, | ||
} | ||
|
||
|
||
@pytest.mark.iceberg | ||
class TestTableProperties(BaseTableProperties): | ||
# Configuration in dbt_project.yml | ||
@pytest.fixture(scope="class") | ||
def project_config_update(self): | ||
return { | ||
"name": "properties_test", | ||
"models": { | ||
"+materialized": "table", | ||
"+properties": { | ||
"format": "'PARQUET'", | ||
"format_version": "2", | ||
}, | ||
}, | ||
} | ||
|
||
def test_table_properties(self, project): | ||
# Seed seed | ||
results = run_dbt(["seed"], expect_pass=True) | ||
assert len(results) == 1 | ||
|
||
# Create model with properties | ||
results, logs = run_dbt_and_capture(["--debug", "run"], expect_pass=True) | ||
assert len(results) == 1 | ||
assert "WITH (" in logs | ||
assert "format = 'PARQUET'" in logs | ||
assert "format_version = 2" in logs |