dbt-labs/dbt-core · error

Unknown method on BaseRelationObject: '{name}'

Error message

Unknown method on BaseRelationObject: '{name}'

What it means

The `call_method` dispatcher on `BaseRelationObject` received a method name that is not in its supported match arms. minijinja objects expose methods via this dispatcher; any name falling through the `_ =>` arm produces this UnknownMethod error. It is the Rust-side equivalent of Python's AttributeError on the relation object.

Source

Thrown at crates/dbt-adapter/src/relation/relation_object.rs:338

                self.from_config(&config)
            }
            // Below are available for Databricks
            "is_hive_metastore" => Ok(Value::from(self.is_hive_metastore())),
            "enrich" => self.relation_enrich(args),
            "render_constraints_for_create" => self.relation_render_constraints_for_create(),
            // Below are available for BigQuery and Redshift
            "materialized_view_config_changeset" => {
                let iter = ArgsIter::new(
                    "materialized_view_config_changeset",
                    &["relation_results", "relation_config"],
                    args,
                );
                let relation_results = iter.next_arg::<Value>()?;
                let relation_config = iter.next_arg::<Value>()?;
                iter.finish()?;
                self.materialized_view_config_changeset(&relation_results, &relation_config)
            }
            _ => Err(minijinja::Error::new(
                minijinja::ErrorKind::UnknownMethod,
                format!("Unknown method on BaseRelationObject: '{name}'"),
            )),
        }
    }

    fn get_value(self: &Arc<Self>, key: &Value) -> Option<Value> {
        match key.as_str() {
            Some("database") => Some(Value::from(self.database())),
            Some("schema") => Some(Value::from(self.schema())),
            Some("identifier") | Some("name") | Some("table") => {
                Some(Value::from(self.identifier()))
            }

            Some("is_table") => Some(Value::from(self.is_table())),
            Some("is_delta") => Some(Value::from(self.is_delta())),
            Some("alter_constraints") => {
                let dbx = self.relation.as_any().downcast_ref::<Relation>()?;

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Check the method name spelling against the methods implemented in `relation_object.rs` (the match arms of `call_method`).
  2. If porting a Python dbt macro, verify the equivalent Rust-side method exists; if missing, implement it in the `call_method` dispatcher or use an alternative available method.
  3. Use `adapter.type()`-specific relation objects if the method is adapter-specific rather than the base relation object.

Example fix

// before (typo)
{% set sch = relation.schma %}
// after
{% set sch = relation.schema %}
Defensive patterns

Strategy: type-guard

Validate before calling

{% if relation is mapping or relation is string %}{% else %}{% do log('relation object unexpected', true) %}{% endif %}

Type guard

// Rust side: verify the method exists before dispatch
if !SUPPORTED_METHODS.contains(&name.as_str()) {
    return Err(unknown_method(name));
}

Try / catch

{% set maybe = relation.render_constraints_for_create() if relation.render_constraints_for_create is defined else none %}
{% if maybe is none %}{% do exceptions.raise_compiler_error('method unavailable') %}{% endif %}

Prevention

When it happens

Trigger: Invoking any attribute/method on a relation object in Jinja whose name is not one of the implemented methods (e.g. a typo like `relation.schma`, or a Python dbt method that has not been ported to this Rust adapter).

Common situations: Migrating Python dbt macros to the Rust engine where some BaseRelation methods are not yet implemented; typos in macro code; calling adapter-specific relation methods that exist only on subclass objects.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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