{"record":{"id":"ec10fb1e41467eed","repo":"dbt-labs/dbt-core","slug":"get-temp-relation-path-relation-database-is-requi","errorCode":null,"errorMessage":"get_temp_relation_path: relation.database is required","messagePattern":"get_temp_relation_path: relation\\.database is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/adapter/mod.rs","lineNumber":4161,"sourceCode":"            \"get_temp_relation_path\" => {\n                // model: Any, batch_id: str = \"\"\n                let iter = ArgsIter::new(name, &[\"relation\"], args);\n                let relation_val = iter.next_arg::<&Value>()?;\n                let batch_id = iter.next_kwarg::<Option<&str>>(\"batch_id\")?.unwrap_or(\"\");\n                iter.finish()?;\n                let database = relation_val\n                    .get_attr(\"database\")\n                    .ok()\n                    .and_then(|v| {\n                        if v.is_undefined() || v.is_none() {\n                            None\n                        } else {\n                            v.as_str().map(|s| s.to_owned())\n                        }\n                    })\n                    .filter(|s| !s.is_empty())\n                    .ok_or_else(|| {\n                        minijinja::Error::new(\n                            minijinja::ErrorKind::InvalidOperation,\n                            \"get_temp_relation_path: relation.database is required\",\n                        )\n                    })?;\n                let identifier = relation_val\n                    .get_attr(\"identifier\")\n                    .ok()\n                    .and_then(|v| {\n                        if v.is_undefined() || v.is_none() {\n                            None\n                        } else {\n                            v.as_str().map(|s| s.to_owned())\n                        }\n                    })\n                    .filter(|s| !s.is_empty())\n                    .ok_or_else(|| {\n                        minijinja::Error::new(\n                            minijinja::ErrorKind::InvalidOperation,","sourceCodeStart":4143,"sourceCodeEnd":4179,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/adapter/mod.rs#L4143-L4179","documentation":"An InvalidOperation minijinja error from get_temp_relation_path stating that `relation.database` is required. The callable extracts database and identifier attributes from a relation Value; if database is missing, not a string, or an empty string, no valid temp path can be built and the error is thrown.","triggerScenarios":"Calling get_temp_relation_path with a relation whose `database` attribute is absent, null, an empty string, or a non-string Value (e.g. an object from a custom relation class that overrides database).","commonSituations":"Databases that intentionally have no database concept (e.g. SQLite/DuckDB-style) combined with temp-relation features; relations built by hand without database; cross-project relations where quoting dropped the field.","solutions":["Ensure the relation has a non-empty string `database` before calling, e.g. `this.database` from a fully qualified relation.","If your adapter legitimately has no database, provide a default database name in profiles/relations instead of leaving it empty.","Fix the relation construction so database is set (check quoting/`render` of the relation object).","Guard the call: only invoke get_temp_relation_path when `relation.database` is truthy."],"exampleFix":"// before\n{% set path = get_temp_relation_path(relation, batch_id) %} // relation.database == ''\n// after\n{% if relation.database %}{% set path = get_temp_relation_path(relation, batch_id) %}{% endif %}","handlingStrategy":"validation","validationCode":"{% if relation.database is not defined or not relation.database %}\n  {% do exceptions.raise_compiler_error('relation.database required for temp relation path') %}\n{% endif %}","typeGuard":"fn has_database(v: &Value) -> bool {\n    v.get_attr(\"database\").ok().and_then(|d| d.as_str().map(|s| !s.is_empty())).unwrap_or(false)\n}","tryCatchPattern":"match database { Some(db) if !db.is_empty() => ..., _ => Err(invalid_operation(\"relation.database is required\")) }","preventionTips":["Use fully qualified relations (`this.database`) in temp-relation flows","Configure a default database for adapters without a database concept","Validate relation attributes at construction time"],"tags":["jinja","relation","temp-relation"],"backgroundTag":"empty-required-field","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}