{"record":{"id":"8d42ae81bad941c8","repo":"dbt-labs/dbt-core","slug":"svv-columns-must-be-an-agatetable","errorCode":null,"errorMessage":"svv_columns must be an AgateTable","messagePattern":"svv_columns must be an AgateTable","errorType":"exception","errorClass":"minijinja::Error::InvalidOperation","httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/adapter/mod.rs","lineNumber":571,"sourceCode":"                    &[\"show_tables_results\", \"svv_columns\"],\n                    args,\n                );\n                let show_tables_value = iter.next_arg::<&Value>()?;\n                let mut show_tables_results: Vec<Arc<AgateTable>> = Vec::new();\n                for table_value in show_tables_value.try_iter()? {\n                    let table = table_value.downcast_object::<AgateTable>().ok_or_else(|| {\n                        minijinja::Error::new(\n                            minijinja::ErrorKind::InvalidOperation,\n                            \"show_tables_results must contain AgateTables\",\n                        )\n                    })?;\n                    show_tables_results.push(table);\n                }\n                let svv_columns = iter\n                    .next_arg::<&Value>()?\n                    .downcast_object::<AgateTable>()\n                    .ok_or_else(|| {\n                        minijinja::Error::new(\n                            minijinja::ErrorKind::InvalidOperation,\n                            \"svv_columns must be an AgateTable\",\n                        )\n                    })?;\n                iter.finish()?;\n\n                let catalog = adapter.build_catalog_from_show_tables_and_svv_columns(\n                    &show_tables_results,\n                    svv_columns,\n                )?;\n                Ok(Value::from_object(catalog))\n            }\n            // During parse phase queries don't execute, so there are no real tables to join.\n            Parse(_) => Ok(Value::from_object(AgateTable::default())),\n        }\n    }\n\n    /// Encloses identifier in the correct quotes for the adapter when escaping reserved column names etc.","sourceCodeStart":553,"sourceCodeEnd":589,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/adapter/mod.rs#L553-L589","documentation":"The same catalog builder also requires the `svv_columns` argument to be a single AgateTable (the SVV_REDSHIFT_COLUMNS snapshot). This error is raised when downcasting that argument fails. The library enforces this so column metadata joins against the show-tables tables use the agate table API.","triggerScenarios":"Passing anything other than an AgateTable as the `svv_columns` argument to build_catalog_from_show_tables_and_svv_columns — e.g. a dict, list of rows, or serialized JSON of SVV_REDSHIFT_COLUMNS.","commonSituations":"Custom Redshift catalog scripts feed SVV query output directly as Python dicts; or argument order was swapped so the wrong value lands in the svv_columns slot.","solutions":["Convert the SVV columns result with load_agate_table() before calling the builder","Verify argument order: show_tables_results first, then svv_columns","If the SVV query returned nothing, pass an empty AgateTable rather than None or a dict"],"exampleFix":"// before\nsvv_columns = cursor.fetchall()\n// after\nsvv_columns = load_agate_table({'column': [{'name': d[0], 'data_type': d[1]} for d in cursor.fetchall()]})","handlingStrategy":"type-guard","validationCode":"# python guard before the call\nif svv_columns is None or not hasattr(svv_columns, 'column_names'):\n    svv_columns = load_agate_table(svv_rows)","typeGuard":"fn is_agate_table(v: &Value) -> bool {\n    v.downcast_object::<AgateTable>().is_some()\n}","tryCatchPattern":"match svv_value.downcast_object::<AgateTable>() {\n    Some(t) => build_catalog(show_tables_results, t),\n    None => Err(minijinja::Error::new(minijinja::ErrorKind::InvalidOperation, \"svv_columns must be an AgateTable\")),\n}","preventionTips":["Load SVV_REDSHIFT_COLUMNS output through load_agate_table() before catalog building","Confirm argument ordering matches the function signature","Pass an empty AgateTable rather than None when the SVV query returns no rows"],"tags":["catalog","redshift","svv-columns","agate"],"backgroundTag":"invalid-argument-value","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"}