Skip to content

Commit

Permalink
backport 798 to 1.5.latest (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleArk authored Jun 14, 2023
1 parent 03d5d15 commit 9d14652
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/functional/adapter/test_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
BaseConstraintsRollback,
BaseIncrementalConstraintsRuntimeDdlEnforcement,
BaseIncrementalConstraintsRollback,
BaseConstraintQuotedColumn,
)
from dbt.tests.adapter.constraints.fixtures import (
constrained_model_schema_yml,
Expand All @@ -24,6 +25,8 @@
my_model_wrong_order_depends_on_fk_sql,
foreign_key_model_sql,
my_model_incremental_wrong_order_depends_on_fk_sql,
my_model_with_quoted_column_name_sql,
model_quoted_column_schema_yml,
)

# constraints are enforced via 'alter' statements that run after table creation
Expand Down Expand Up @@ -260,6 +263,36 @@ def models(self):
}


@pytest.mark.skip_profile("spark_session", "apache_spark", "databricks_http_cluster")
class TestSparkConstraintQuotedColumn(PyodbcSetup, BaseConstraintQuotedColumn):
@pytest.fixture(scope="class")
def models(self):
return {
"my_model.sql": my_model_with_quoted_column_name_sql,
"constraints_schema.yml": model_quoted_column_schema_yml.replace(
"text", "string"
).replace('"from"', "`from`"),
}

@pytest.fixture(scope="class")
def expected_sql(self):
return """
create or replace table <model_identifier>
using delta
as
select
id,
`from`,
date_day
from
(
select
'blue' as `from`,
1 as id,
'2019-01-01' as date_day ) as model_subq
"""


class BaseSparkConstraintsRollbackSetup:
@pytest.fixture(scope="class")
def project_config_update(self):
Expand Down

0 comments on commit 9d14652

Please sign in to comment.