Skip to content

Commit 83a8384

Browse files
committed
fix: Update model constraints functional test expectation for SQL Server contract INSERT semantics
- Adjust test_constraints.py expected SQL in `TestModelConstraintsRuntimeEnforcement::test__model_constraints_ddl` - Include `WITH (TABLOCK)` in the `INSERT INTO <model_identifier>` clause to match current adapter SQL generation
1 parent e813d7f commit 83a8384

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tests/functional/adapter/dbt/test_constraints.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ def models(self):
472472
@pytest.fixture(scope="class")
473473
def expected_sql(self):
474474
return """
475-
EXEC(' CREATE OR ALTER VIEW <model_identifier> AS -- depends_on: <foreign_key_model_identifier> select ''blue'' as color, 1 as id, ''2019-01-01'' as date_day; ') EXEC(' CREATE TABLE <model_identifier> ( id int not null , color varchar(100), date_day varchar(100) ) INSERT INTO <model_identifier> ( [id], [color], [date_day] ) SELECT [id], [color], [date_day] FROM <model_identifier> ') EXEC('DROP VIEW IF EXISTS <model_identifier>
475+
EXEC(' CREATE OR ALTER VIEW <model_identifier> AS -- depends_on: <foreign_key_model_identifier> select ''blue'' as color, 1 as id, ''2019-01-01'' as date_day; ') EXEC(' CREATE TABLE <model_identifier> ( id int not null , color varchar(100), date_day varchar(100) ) INSERT INTO <model_identifier> WITH (TABLOCK) ( [id], [color], [date_day] ) SELECT [id], [color], [date_day] FROM <model_identifier> ') EXEC('DROP VIEW IF EXISTS <model_identifier>
476476
"""
477477

478478
# EXEC('DROP view IF EXISTS <model_identifier>
@@ -592,7 +592,7 @@ def models(self):
592592
@pytest.fixture(scope="class")
593593
def expected_sql(self):
594594
return """
595-
EXEC(' CREATE OR ALTER VIEW <model_identifier> AS -- depends_on: <foreign_key_model_identifier> select ''blue'' as color, 1 as id, ''2019-01-01'' as date_day; ') EXEC(' CREATE TABLE <model_identifier> ( id int not null , color varchar(100), date_day varchar(100) ) INSERT INTO <model_identifier> ( [id], [color], [date_day] ) SELECT [id], [color], [date_day] FROM <model_identifier> ') EXEC('DROP VIEW IF EXISTS <model_identifier>
595+
EXEC(' CREATE OR ALTER VIEW <model_identifier> AS -- depends_on: <foreign_key_model_identifier> select ''blue'' as color, 1 as id, ''2019-01-01'' as date_day; ') EXEC(' CREATE TABLE <model_identifier> ( id int not null , color varchar(100), date_day varchar(100) ) INSERT INTO <model_identifier> WITH (TABLOCK) ( [id], [color], [date_day] ) SELECT [id], [color], [date_day] FROM <model_identifier> ') EXEC('DROP VIEW IF EXISTS <model_identifier>
596596
"""
597597

598598
def test__model_constraints_ddl(self, project, expected_sql):

0 commit comments

Comments
 (0)