-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Is this a regression in a recent version of dbt-core?
- I believe this is a regression in dbt-core functionality
- I have searched the existing issues, and I could not find an existing issue for this regression
Current Behavior
Executing on dbt-cloud.
Model Primary key constraint is populating without the enforce_contract set to true and a full model contract was provided.
Example model:
- name: pk_example
columns:
- name: primary_key_column
description: My column
tests:
- not_null
- unique
constraints:
- type: primary_key
columns: [primary_key_column]
This fails because it tries to apply the PK constraint but in this case we didn't actually also set the required not_null constraint.
{"app": "dbt", "dbt_version": "2026.1.26+c924ee8", "dbt_databricks_version": "1.11.4post1+ec229f85e80de8737ba308b58059fef56cf9e3fd", "databricks_sql_connector_version": "4.1.3", "profile_name": "user", "target_name": "prod", "connection_name": "master"}
Expected/Previous Behavior
Previous behavior, the primary_key constraint is not applied without having enforce_contract: true (see further examples here feature request where I had actually requested this capability be added).
The PK constraint was intended to be applied but previous behavior was that it wasn't without a full contract. This caused our jobs to fail because we had not set non-nullable on the PK fields, but had never needed to because the constraint was never actually applied.
Prior successful runs that didn't apply the PK
{"app": "dbt", "dbt_version": "2026.1.19+d634a9b", "dbt_databricks_version": "1.11.3post1+cd5d71f50cd9f003e2f879dc6729a3aa93e1cdaf", "databricks_sql_connector_version": "4.1.3", "profile_name": "user", "target_name": "prod", "connection_name": "master"}
Steps To Reproduce
-
dbt cloud on latest
-
define a model with a PK constraint but do not set enforce_contract
-
Run - model will be created with the PK constraint
-
dbt cloud compatible version
-
run same model - the PK constraint will not be added
Relevant log output
Environment
- dbt (working version): 2026.1.19+d634a9b
- dbt (regression version):2026.1.26+c924ee8
- dbt-databricks (working): 1.11.3post1+cd5d71f50cd9f003e2f879dc6729a3aa93e1cdaf
- dbt-databricks (regression): 1.11.4post1+ec229f85e80de8737ba308b58059fef56cf9e3fdWhich database adapter are you using with dbt?
other (mention it in "Additional Context")
Additional Context
I'm mainly raising because I do not see any release notes here or on the dbt-databricks adapter that lead me to believe this was an intended change. I've actually requested this behavior Feature request, and so am glad if this was intended but also want to make sure it doesn't just get removed since it wasn't.