Skip to content

Commit

Permalink
[Bug] Fix constraints enforcement rollover test (#1041)
Browse files Browse the repository at this point in the history
* unskip offending test case
* update help in example test env file
* install pyodbc from source to support arm machines
* allow for both col and column
  • Loading branch information
mikealfare authored May 10, 2024
1 parent 94bfcd9 commit 1f4442a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pyhive[hive_pure_sasl]~=0.7.0
requests>=2.28.1

pyodbc~=5.0.1
pyodbc~=5.0.1 --no-binary pyodbc
sqlparams>=3.0.0
thrift>=0.13.0
sqlparse>=0.4.2 # not directly required, pinned by Snyk to avoid a vulnerability
Expand Down
16 changes: 6 additions & 10 deletions test.env.example
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# Cluster ID
DBT_DATABRICKS_CLUSTER_NAME=
# SQL Endpoint
DBT_DATABRICKS_ENDPOINT=
# Server Hostname value
DBT_DATABRICKS_HOST_NAME=
# personal token
DBT_DATABRICKS_TOKEN=
# file path to local ODBC driver
ODBC_DRIVER=
# databricks credentials
DBT_DATABRICKS_HOST_NAME=<{this value}.cloud.databricks.com>.cloud.databricks.com
DBT_DATABRICKS_TOKEN=<personal token>
DBT_DATABRICKS_CLUSTER_NAME=<sql/protocolv1/o/{not this}/{this value}>
ODBC_DRIVER=</file/path/to/local/ODBC.driver>
DBT_DATABRICKS_ENDPOINT=</sql/1.0/warehouses/{this value}>

# users for testing 'grants' functionality
DBT_TEST_USER_1=
Expand Down
13 changes: 1 addition & 12 deletions tests/functional/adapter/test_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def expected_error_messages(self):
"violate the new NOT NULL constraint",
"(id > 0) violated by row with values:", # incremental mats
"DELTA_VIOLATE_CONSTRAINT_WITH_VALUES", # incremental mats
"NOT NULL constraint violated for column",
"NOT NULL constraint violated for col",
]

def assert_expected_error_messages(self, error_message, expected_error_messages):
Expand Down Expand Up @@ -358,17 +358,6 @@ def models(self):
"constraints_schema.yml": constraints_yml,
}

@pytest.mark.skip(
"Databricks now raises an exception, which gets raised prior to the `expected_pass` check."
"See https://github.com/dbt-labs/dbt-spark/issues/1009"
)
def test__constraints_enforcement_rollback(
self, project, expected_color, expected_error_messages, null_model_sql
):
super().test__constraints_enforcement_rollback(
project, expected_color, expected_error_messages, null_model_sql
)


# TODO: Like the tests above, this does test that model-level constraints don't
# result in errors, but it does not verify that they are actually present in
Expand Down

0 comments on commit 1f4442a

Please sign in to comment.