{"record":{"id":"94a1652dac3f4b26","repo":"dbt-labs/dbt-core","slug":"enrich-is-only-available-for-databricks-relations","errorCode":null,"errorMessage":"enrich is only available for Databricks relations","messagePattern":"enrich is only available for Databricks relations","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/relation/relation_object.rs","lineNumber":100,"sourceCode":"        }\n    }\n\n    pub fn has_filter(&self) -> bool {\n        self.run_filter.is_some()\n    }\n\n    pub fn event_time(&self) -> Option<&str> {\n        self.event_time.as_deref()\n    }\n\n    /// Databricks: enrich relation with constraints (for get_column_and_constraints_sql)\n    fn relation_enrich(self: &Arc<Self>, args: &[Value]) -> Result<Value, minijinja::Error> {\n        let dbx = self\n            .relation\n            .as_any()\n            .downcast_ref::<Relation>()\n            .ok_or_else(|| {\n                minijinja::Error::new(\n                    minijinja::ErrorKind::InvalidOperation,\n                    \"enrich is only available for Databricks relations\",\n                )\n            })?;\n        let constraints_val = args.first().cloned().unwrap_or_default();\n        let constraints: Vec<TypedConstraint> = constraints_val\n            .try_iter()\n            .map_err(|e| {\n                minijinja::Error::new(\n                    minijinja::ErrorKind::InvalidOperation,\n                    format!(\"enrich constraints must be iterable: {e}\"),\n                )\n            })?\n            .map(|v| {\n                v.downcast_object_ref::<TypedConstraint>()\n                    .cloned()\n                    .ok_or_else(|| {\n                        minijinja::Error::new(","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/relation/relation_object.rs#L82-L118","documentation":"relation_enrich (backing get_column_and_constraints_sql) downcasts the inner relation to the Databricks Relation implementation; on any other adapter's relation type the downcast fails and this guard fires — enrichment with constraints is a Databricks-only capability.","triggerScenarios":"Thrown at crates/dbt-adapter/src/relation/relation_object.rs:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call enrich only for Databricks relations (gate in the macro)","Add an enrich path for other adapters if constraints support is needed there","Return a structured error instead of a bare minijinja InvalidOperation"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}