File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -1632,6 +1632,7 @@ def create_seed_model(
16321632 name : str ,
16331633 seed_kind : SeedKind ,
16341634 * ,
1635+ dialect : t .Optional [str ] = None ,
16351636 pre_statements : t .Optional [t .List [exp .Expression ]] = None ,
16361637 post_statements : t .Optional [t .List [exp .Expression ]] = None ,
16371638 defaults : t .Optional [t .Dict [str , t .Any ]] = None ,
@@ -1678,6 +1679,7 @@ def create_seed_model(
16781679 return _create_model (
16791680 SeedModel ,
16801681 name ,
1682+ dialect = dialect ,
16811683 defaults = defaults ,
16821684 path = path ,
16831685 seed = seed ,
Original file line number Diff line number Diff line change @@ -23,5 +23,6 @@ def to_sqlmesh(self, context: DbtContext) -> Model:
2323 return create_seed_model (
2424 self .sql_name ,
2525 SeedKind (path = self .path .absolute ().as_posix ()),
26+ dialect = context .dialect ,
2627 ** self .sqlmesh_model_kwargs (context ),
2728 )
Original file line number Diff line number Diff line change 11import typing as t
22from pathlib import Path
3+ from unittest .mock import PropertyMock
34
45import pytest
56from dbt .adapters .base import BaseRelation , Column
67from dbt .adapters .duckdb .relation import DuckDBRelation
78from dbt .contracts .relation import Policy
9+ from pytest_mock import MockerFixture
810
911from sqlmesh .core .dialect import jinja_query
1012from sqlmesh .core .model import SqlModel
@@ -307,7 +309,7 @@ def test_source_config(sushi_test_project: Project):
307309 assert source_configs ["streaming.order_items" ].sql_name == "raw.order_items"
308310
309311
310- def test_seed_config (sushi_test_project : Project ):
312+ def test_seed_config (sushi_test_project : Project , mocker : MockerFixture ):
311313 seed_configs = sushi_test_project .packages ["sushi" ].seeds
312314 assert set (seed_configs ) == {"waiter_names" }
313315 raw_items_seed = seed_configs ["waiter_names" ]
@@ -320,6 +322,10 @@ def test_seed_config(sushi_test_project: Project):
320322 assert actual_config == expected_config
321323
322324 assert raw_items_seed .sql_name == "sushi.waiter_names"
325+ assert raw_items_seed .to_sqlmesh (sushi_test_project .context ).name == "sushi.waiter_names"
326+ mock_dialect = PropertyMock (return_value = "snowflake" )
327+ mocker .patch ("sqlmesh.dbt.context.DbtContext.dialect" , mock_dialect )
328+ assert raw_items_seed .to_sqlmesh (sushi_test_project .context ).name == "SUSHI.WAITER_NAMES"
323329
324330
325331def test_quoting ():
You can’t perform that action at this time.
0 commit comments