dbt-labs/dbt-core · error

render should be accessible

Error message

render should be accessible

What it means

Test-only assertion in test_constraints_to_jinja_exposes_object_attributes: the constraint object must expose a `render` attribute (the rendered DDL fragment) usable from Jinja. Fires only if the render method disappears from the per-constraint Jinja object.

Solutions

  1. Expose a render method/attribute on the per-constraint Jinja object
  2. Check the method dispatch table of the constraint wrapper type
  3. Treat failure as a regression in Jinja constraint rendering
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/dbt-adapter/src/relation/databricks/config/components/constraints.rs:968 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/2da06d27bcb5fb19. Report an issue: GitHub.

Appendix: source

Thrown at crates/dbt-adapter/src/relation/databricks/config/components/constraints.rs:968

            .expect("unset_constraints should be accessible");
        let mut iter = unset
            .try_iter()
            .expect("unset_constraints should be iterable");
        let constraint_val = iter.next().expect("should have one constraint");

        let type_val = constraint_val
            .get_attr("type")
            .expect("type should be accessible");
        assert_eq!(type_val.as_str(), Some("primary_key"));

        let name_val = constraint_val
            .get_attr("name")
            .expect("name should be accessible");
        assert_eq!(name_val.as_str(), Some("pk_id"));

        let render_val = constraint_val
            .get_attr("render")
            .expect("render should be accessible");
        assert!(
            !render_val.is_undefined(),
            "render should be a callable function"
        );
    }

    #[test]
    fn test_constraint_normalization_and_diff() {
        let prev_constraint = TypedConstraint::Check {
            name: Some("test_check".to_string()),
            expression: "value > 0".to_string(),
            columns: Some(vec!["value".to_string()]), // With columns (from dbt definition)
        };
        let next_constraint = TypedConstraint::Check {
            name: Some("test_check".to_string()),
            expression: "value > 0".to_string(),
            columns: None, // No columns (like Databricks stores it)
        };

View on GitHub (pinned to 0267ce9170)