dbt-labs/dbt-core · error
'materialized_view_from_relation_config' can only be invoked
Error message
'materialized_view_from_relation_config' can only be invoked using the BigQuery adapter
What it means
The `materialized_view_from_relation_config` method on the relation object is BigQuery-specific; it exists because BigQuery materialized view macros need to rebuild a materialized view from its relation config. Calling it under any other adapter raises this InvalidOperation error before any argument parsing happens.
Source
Thrown at crates/dbt-adapter/src/relation/relation_object.rs:754
self.0.as_ref()
}
}
impl Object for StaticBaseRelationObject {
fn call_method(
self: &Arc<Self>,
_state: &State,
name: &str,
args: &[Value],
_listeners: &[std::rc::Rc<dyn RenderingEventListener>],
) -> Result<Value, minijinja::Error> {
match name {
"create" => self.create(args),
"scd_args" => self.scd_args(args),
// // The following is required by BigQuery materialized_views
"materialized_view_from_relation_config" => {
if self.0.get_adapter_type() != AdapterType::Bigquery.as_ref() {
return Err(minijinja::Error::new(
minijinja::ErrorKind::InvalidOperation,
"'materialized_view_from_relation_config' can only be invoked using the BigQuery adapter",
));
}
let iter = ArgsIter::new(
"Relation.materialized_view_from_relation_config",
&["local_config"],
args,
);
let local_config_value = iter.next_arg::<&Value>()?;
iter.finish()?;
let local_config = minijinja_value_to_typed_struct::<InternalDbtNodeWrapper>(
local_config_value.clone(),
)
.map_err(|e| {
minijinja::Error::new(View on GitHub (pinned to 0267ce9170)
Solutions
- Only call this method in BigQuery-specific macros; guard with `{% if adapter.type() == 'bigquery' %}`.
- For other adapters, use their native materialized-view support instead of this config-reconstruction path.
- Verify the target materialization is `bigquery` (not e.g. a shared materialized_view materialization copied between projects).
Example fix
// before
{{ relation.materialized_view_from_relation_config(relation_results, relation_config) }}
// after
{% if adapter.type() == 'bigquery' %}
{{ relation.materialized_view_from_relation_config(relation_results, relation_config) }}
{% endif %} Defensive patterns
Strategy: validation
Validate before calling
{% if adapter.type() != 'bigquery' %}
{% do exceptions.raise_compiler_error('materialized_view_from_relation_config requires BigQuery') %}
{% endif %} Prevention
- Guard BigQuery-specific methods behind adapter type checks.
- Do not copy BigQuery materialization macros into other-adapter projects unmodified.
- Keep adapter-specific materializations in their adapter's include path.
When it happens
Trigger: Invoking `relation.materialized_view_from_relation_config(...)` in a Jinja macro while `adapter.type()` is not `bigquery`.
Common situations: Running BigQuery materialized-view macros (e.g. from dbt-bigquery's materialization) against another adapter; copying BigQuery materialization code into a Snowflake/Databricks project.
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
- only available with BigQuery adapter
- get_bq_table
- describe_dynamic_table is not supported by the {} adapter
- describe_interactive_table is not supported by the {} adapte
- invalid return value
AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07).
Data as JSON: /api/errors/73cb75c5463a195b.
Report an issue: GitHub.