-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
82 additions
and
2,583 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,6 @@ | ||
kind: Fixes | ||
body: Fix `persist_docs` for `materialized_view` materializations. Previously, using this configuration with materialized view models would lead to an error. | ||
time: 2024-06-26T16:39:30.455995+02:00 | ||
custom: | ||
Author: morsapaes | ||
Issue: "120" |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,65 @@ | ||
import pytest | ||
import json | ||
|
||
from dbt.tests.adapter.materialized_view import files | ||
from dbt.tests.adapter.persist_docs.test_persist_docs import ( | ||
BasePersistDocs, | ||
BasePersistDocsColumnMissing, | ||
BasePersistDocsCommentOnQuotedColumn, | ||
) | ||
from tests.functional.utils import run_dbt | ||
|
||
_MATERIALIZED_VIEW_PROPERTIES__SCHEMA_YML = """ | ||
version: 2 | ||
models: | ||
- name: my_materialized_view | ||
description: | | ||
Materialized view model description "with double quotes" | ||
and with 'single quotes' as welll as other; | ||
'''abc123''' | ||
reserved -- characters | ||
80% of statistics are made up on the spot | ||
-- | ||
/* comment */ | ||
Some $lbl$ labeled $lbl$ and $$ unlabeled $$ dollar-quoting | ||
""" | ||
|
||
|
||
class TestPersistDocs(BasePersistDocs): | ||
pass | ||
|
||
|
||
class TestPersistDocsColumnMissing(BasePersistDocsColumnMissing): | ||
pass | ||
|
||
|
||
class TestPersistDocsCommentOnQuotedColumn(BasePersistDocsCommentOnQuotedColumn): | ||
pass | ||
|
||
|
||
class TestPersistDocsWithMaterializedView(BasePersistDocs): | ||
@pytest.fixture(scope="class", autouse=True) | ||
def seeds(self): | ||
return {"my_seed.csv": files.MY_SEED} | ||
|
||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return { | ||
"my_materialized_view.sql": files.MY_MATERIALIZED_VIEW, | ||
} | ||
|
||
@pytest.fixture(scope="class") | ||
def properties(self): | ||
return { | ||
"schema.yml": _MATERIALIZED_VIEW_PROPERTIES__SCHEMA_YML, | ||
} | ||
|
||
def test_has_comments_pglike(self, project): | ||
run_dbt(["docs", "generate"]) | ||
with open("target/catalog.json") as fp: | ||
catalog_data = json.load(fp) | ||
assert "nodes" in catalog_data | ||
assert len(catalog_data["nodes"]) == 2 | ||
view_node = catalog_data["nodes"]["model.test.my_materialized_view"] | ||
assert view_node["metadata"]["comment"].startswith("Materialized view model description") |
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
tests/functional/simple_snapshot/data/invalidate_postgres.sql
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.