{"record":{"id":"cc0b7290ed7d931c","repo":"dbt-labs/dbt-core","slug":"database-is-required","errorCode":null,"errorMessage":"database is required","messagePattern":"database is required","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/python/snowflake/mod.rs","lineNumber":20,"sourceCode":"use minijinja::{State, Value};\n\nconst DEFAULT_SNOWFLAKE_PYTHON_PACKAGE: &str = \"snowflake-snowpark-python\";\n\npub fn finalize_python_code(\n    state: &State,\n    model: &Value,\n    compiled_code: &str,\n) -> AdapterResult<String> {\n    // Extract config from model\n    let config = model\n        .get_attr(\"config\")\n        .map_err(|e| AdapterError::new(AdapterErrorKind::Internal, e.to_string()))?;\n\n    let database = model\n        .get_attr(\"database\")\n        .ok()\n        .and_then(|v| v.as_str().map(|s| s.to_string()))\n        .expect(\"database is required\");\n    let schema = model\n        .get_attr(\"schema\")\n        .ok()\n        .and_then(|v| v.as_str().map(|s| s.to_string()))\n        .expect(\"schema is required\");\n    let alias = model\n        .get_attr(\"alias\")\n        .ok()\n        .and_then(|v| v.as_str().map(|s| s.to_string()))\n        .unwrap_or_default();\n\n    // Get python_version from config, default to \"3.11\"\n    let python_version = config\n        .get_attr(\"python_version\")\n        .ok()\n        .and_then(|v| v.as_str().map(|s| s.to_string()))\n        .unwrap_or_else(|| \"3.11\".to_string());\n","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/python/snowflake/mod.rs#L2-L38","documentation":"Invariant expect in finalize_python_code: the model value is expected to always carry a `database` attribute (Snowflake models always have a database), but the attribute was missing or not a string, so the Python job's target path cannot be built. Indicates the model object passed in is not a properly populated Snowflake model node.","triggerScenarios":"Thrown at crates/dbt-adapter/src/python/snowflake/mod.rs:20 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the model node has a database set (check profile/target configuration)","Verify the model value passed to submit_python_job is a real model node, not a test stub missing `database`","Report as an internal bug if the database is genuinely absent in a valid run"],"exampleFix":null,"handlingStrategy":"validation","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"}