Skip to content

Commit

Permalink
Put back Union order changes, use dbtClassMixin in test_serialization.py
Browse files Browse the repository at this point in the history
  • Loading branch information
gshank committed Dec 19, 2024
1 parent d1274b1 commit 5f94de5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion core/dbt/artifacts/resources/v1/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from dbt_common.dataclass_schema import ExtensibleDbtClassMixin, dbtClassMixin
from dbt_semantic_interfaces.type_enums import TimeGranularity

NodeVersion = Union[str, float]
NodeVersion = Union[int, float, str]


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/artifacts/resources/v1/source_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ExternalTable(AdditionalPropertiesAllowed, Mergeable):
file_format: Optional[str] = None
row_format: Optional[str] = None
tbl_properties: Optional[str] = None
partitions: Optional[Union[List[str], List[ExternalPartition]]] = None
partitions: Optional[Union[List[ExternalPartition], List[str]]] = None

def __bool__(self):
return self.location is not None
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/parser/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def _add_yaml_snapshot_nodes_to_manifest(
snapshot_node = parser._create_parsetime_node(
block,
compiled_path,
parser.initial_config(fqn),
parser.initial_config_builder(fqn),
fqn,
snapshot["name"],
)
Expand Down
8 changes: 3 additions & 5 deletions tests/functional/artifacts/test_serialization.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Union

import pytest
from mashumaro.mixins.msgpack import DataClassMessagePackMixin
from dbt_common.dataclass_schema import dbtClassMixin


@dataclass
class ExternalPartition(DataClassMessagePackMixin):
class ExternalPartition(dbtClassMixin):
name: str = ""
description: str = ""
data_type: str = ""
meta: Dict[str, Any] = field(default_factory=dict)


@dataclass
class ExternalTable(DataClassMessagePackMixin):
class ExternalTable(dbtClassMixin):
location: Optional[str] = None
file_format: Optional[str] = None
row_format: Optional[str] = None
tbl_properties: Optional[str] = None
partitions: Optional[Union[List[ExternalPartition], List[str]]] = None


@pytest.mark.skip("skip until mashumaro 3.15")
def test_partitions_serialization():

part1 = ExternalPartition(
Expand Down

0 comments on commit 5f94de5

Please sign in to comment.