diff --git a/core/dbt/artifacts/resources/v1/saved_query.py b/core/dbt/artifacts/resources/v1/saved_query.py index e1d056d0422..8d51845755b 100644 --- a/core/dbt/artifacts/resources/v1/saved_query.py +++ b/core/dbt/artifacts/resources/v1/saved_query.py @@ -2,16 +2,18 @@ import time from dataclasses import dataclass, field -from typing import Any, Dict, List, Literal, Optional +from typing import Any, Dict, List, Literal, Optional, Union from dbt.artifacts.resources.base import GraphResource from dbt.artifacts.resources.types import NodeType from dbt.artifacts.resources.v1.components import DependsOn, RefArgs +from dbt.artifacts.resources.v1.config import list_str, metas from dbt.artifacts.resources.v1.semantic_layer_components import ( SourceFileMetadata, WhereFilterIntersection, ) from dbt_common.contracts.config.base import BaseConfig, CompareBehavior, MergeBehavior +from dbt_common.contracts.config.metadata import ShowBehavior from dbt_common.dataclass_schema import dbtClassMixin from dbt_semantic_interfaces.type_enums.export_destination_type import ( ExportDestinationType, @@ -95,6 +97,10 @@ class SavedQuery(SavedQueryMandatory): depends_on: DependsOn = field(default_factory=DependsOn) created_at: float = field(default_factory=lambda: time.time()) refs: List[RefArgs] = field(default_factory=list) + tags: Union[List[str], str] = field( + default_factory=list_str, + metadata=metas(ShowBehavior.Hide, MergeBehavior.Append, CompareBehavior.Exclude), + ) @property def metrics(self) -> List[str]: diff --git a/core/dbt/contracts/graph/nodes.py b/core/dbt/contracts/graph/nodes.py index 262ec83735e..90d97c26e74 100644 --- a/core/dbt/contracts/graph/nodes.py +++ b/core/dbt/contracts/graph/nodes.py @@ -1603,6 +1603,9 @@ def same_exports(self, old: "SavedQuery") -> bool: return True + def same_tags(self, old: "SavedQuery") -> bool: + return self.tags == old.tags + def same_contents(self, old: Optional["SavedQuery"]) -> bool: # existing when it didn't before is a change! # metadata/tags changes are not "changes" @@ -1618,6 +1621,7 @@ def same_contents(self, old: Optional["SavedQuery"]) -> bool: and self.same_config(old) and self.same_group(old) and self.same_exports(old) + and self.same_tags(old) and True ) diff --git a/core/dbt/contracts/graph/unparsed.py b/core/dbt/contracts/graph/unparsed.py index 5e63c487e89..6bc216c3c32 100644 --- a/core/dbt/contracts/graph/unparsed.py +++ b/core/dbt/contracts/graph/unparsed.py @@ -27,8 +27,11 @@ UnitTestOutputFixture, UnitTestOverrides, ) +from dbt.artifacts.resources.v1.config import list_str, metas from dbt.exceptions import ParsingError from dbt.node_types import NodeType +from dbt_common.contracts.config.base import CompareBehavior, MergeBehavior +from dbt_common.contracts.config.metadata import ShowBehavior from dbt_common.contracts.config.properties import AdditionalPropertiesMixin from dbt_common.contracts.util import Mergeable from dbt_common.dataclass_schema import ( @@ -740,6 +743,10 @@ class UnparsedSavedQuery(dbtClassMixin): label: Optional[str] = None exports: List[UnparsedExport] = field(default_factory=list) config: Dict[str, Any] = field(default_factory=dict) + tags: Union[List[str], str] = field( + default_factory=list_str, + metadata=metas(ShowBehavior.Hide, MergeBehavior.Append, CompareBehavior.Exclude), + ) def normalize_date(d: Optional[datetime.date]) -> Optional[datetime.datetime]: diff --git a/core/dbt/parser/schema_yaml_readers.py b/core/dbt/parser/schema_yaml_readers.py index 9b4a550b5d3..2f0ed337a5f 100644 --- a/core/dbt/parser/schema_yaml_readers.py +++ b/core/dbt/parser/schema_yaml_readers.py @@ -831,6 +831,7 @@ def parse_saved_query(self, unparsed: UnparsedSavedQuery) -> None: config=config, unrendered_config=unrendered_config, group=config.group, + tags=unparsed.tags, ) for export in parsed.exports: @@ -859,6 +860,8 @@ def parse_saved_query(self, unparsed: UnparsedSavedQuery) -> None: def parse(self) -> ParseResult: for data in self.get_key_dicts(): try: + # if isinstance(data["tags"], str): + # data["tags"] = [data["tags"]] UnparsedSavedQuery.validate(data) unparsed = UnparsedSavedQuery.from_dict(data) except (ValidationError, JSONValidationError) as exc: diff --git a/core/setup.py b/core/setup.py index 456e5fedc15..e631968aa65 100644 --- a/core/setup.py +++ b/core/setup.py @@ -69,7 +69,7 @@ # These are major-version-0 packages also maintained by dbt-labs. # Accept patches but avoid automatically updating past a set minor version range. "dbt-extractor>=0.5.0,<=0.6", - "dbt-semantic-interfaces>=0.7.4,<0.8", + # "dbt-semantic-interfaces>=0.7.4,<0.8", # Minor versions for these are expected to be backwards-compatible "dbt-common>=1.11.0,<2.0", "dbt-adapters>=1.8.0,<2.0", diff --git a/editable-requirements.txt b/editable-requirements.txt index 6f81820bb96..5cf12a85ea4 100644 --- a/editable-requirements.txt +++ b/editable-requirements.txt @@ -1 +1,2 @@ -e ./core +-e /Users/patricky/git/dbt-semantic-interfaces diff --git a/schemas/dbt/catalog/v1.json b/schemas/dbt/catalog/v1.json index f104c5b977f..e5c3887c057 100644 --- a/schemas/dbt/catalog/v1.json +++ b/schemas/dbt/catalog/v1.json @@ -12,7 +12,7 @@ }, "dbt_version": { "type": "string", - "default": "1.9.0b2" + "default": "1.9.0b4" }, "generated_at": { "type": "string" diff --git a/schemas/dbt/manifest/v12.json b/schemas/dbt/manifest/v12.json index 4d66f65f234..841fffae32a 100644 --- a/schemas/dbt/manifest/v12.json +++ b/schemas/dbt/manifest/v12.json @@ -13,7 +13,7 @@ }, "dbt_version": { "type": "string", - "default": "1.9.0b2" + "default": "1.9.0b4" }, "generated_at": { "type": "string" @@ -19969,6 +19969,19 @@ "name" ] } + }, + "tags": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "string" + } + ] } }, "additionalProperties": false, @@ -21524,6 +21537,19 @@ "name" ] } + }, + "tags": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "string" + } + ] } }, "additionalProperties": false, @@ -22648,4 +22674,4 @@ "unit_tests" ], "$id": "https://schemas.getdbt.com/dbt/manifest/v12.json" -} +} \ No newline at end of file diff --git a/schemas/dbt/run-results/v6.json b/schemas/dbt/run-results/v6.json index 1bf1cf75e83..28f5ee69058 100644 --- a/schemas/dbt/run-results/v6.json +++ b/schemas/dbt/run-results/v6.json @@ -12,7 +12,7 @@ }, "dbt_version": { "type": "string", - "default": "1.9.0b2" + "default": "1.9.0b4" }, "generated_at": { "type": "string" diff --git a/schemas/dbt/sources/v3.json b/schemas/dbt/sources/v3.json index df2784f1a81..36f52bbf7dc 100644 --- a/schemas/dbt/sources/v3.json +++ b/schemas/dbt/sources/v3.json @@ -12,7 +12,7 @@ }, "dbt_version": { "type": "string", - "default": "1.9.0b2" + "default": "1.9.0b4" }, "generated_at": { "type": "string"