{"record":{"id":"0314e65e3a57b059","repo":"dbt-labs/dbt-core","slug":"unknown-table-type-type-string","errorCode":null,"errorMessage":"unknown table type: {type_string}","messagePattern":"unknown table type: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-schemas/src/dbt_types.rs","lineNumber":54,"sourceCode":"    /// An enum for a ClickHouse dictionary\n    Dictionary,\n}\n\nimpl RelationType {\n    /// Convert a given type string for a given [AdapterType] to a dbt RelationType\n    // TODO: This should return an error instead of panicking.\n    pub fn from_adapter_type(adapter_type: AdapterType, type_string: &str) -> Self {\n        match adapter_type {\n            // https://cloud.google.com/bigquery/docs/information-schema-tables\n            // Alternatively, if querying from the Google API:\n            // https://docs.cloud.google.com/bigquery/docs/reference/rest/v2/tables\n            AdapterType::Bigquery => match type_string.to_uppercase().as_str() {\n                \"BASE TABLE\" | \"CLONE\" | \"SNAPSHOT\" | \"TABLE\" => RelationType::Table,\n                \"VIEW\" => RelationType::View,\n                \"MATERIALIZED VIEW\" | \"MATERIALIZED_VIEW\" => RelationType::MaterializedView,\n                \"EXTERNAL\" => RelationType::External,\n                \"FUNCTION\" | \"AGGREGATE FUNCTION\" => RelationType::Function,\n                _ => panic!(\"unknown table type: {type_string}\"),\n            },\n            // https://docs.databricks.com/aws/en/sql/language-manual/information-schema/tables#table-types\n            AdapterType::Databricks => match type_string.to_uppercase().as_str() {\n                \"TABLE\" => RelationType::Table,\n                \"VIEW\" => RelationType::View,\n                \"MATERIALIZED_VIEW\" => RelationType::MaterializedView,\n                \"EXTERNAL\" | \"EXTERNAL_SHALLOW_CLONE\" | \"FOREIGN\" => RelationType::External,\n                \"STREAMING_TABLE\" => RelationType::StreamingTable,\n                \"METRIC_VIEW\" => RelationType::MetricView,\n                \"MANAGED\" | \"MANAGED_SHALLOW_CLONE\" => RelationType::Table,\n                _ => panic!(\"unknown table type: {type_string}\"),\n            },\n            AdapterType::Spark => match type_string.to_uppercase().as_str() {\n                // These are the only table types Apache Spark's catalog reports\n                // (`CatalogTableType`) via `DESCRIBE TABLE EXTENDED`, identical over\n                // Thrift/Livy/Spark Connect: MANAGED, EXTERNAL, VIEW (released 3.5/4.0)\n                // https://github.com/apache/spark/blob/f0bb2e6a47d0ebda424ffd633fcea8644a597954/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala#L1039\n                \"MANAGED\" | \"EXTERNAL\" => RelationType::Table,","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-schemas/src/dbt_types.rs#L36-L72","documentation":"RelationType::from_adapter_type translates a database-reported table type string (e.g. from information_schema) into a RelationType enum. For BigQuery, only a fixed set of type strings is recognized; anything else panics with 'unknown table type'. The library treats an unrecognized catalog type as a hard error instead of guessing a relation kind.","triggerScenarios":"Calling from_adapter_type with AdapterType::Bigquery and a type_string that uppercases to something outside {BASE TABLE, CLONE, SNAPSHOT, TABLE, VIEW, MATERIALIZED VIEW, MATERIALIZED_VIEW, EXTERNAL, FUNCTION, AGGREGATE FUNCTION} — e.g. a new BigQuery table kind or localized/quoted type output from a metadata query.","commonSituations":"BigQuery introducing a new relation type not yet mapped in the adapter; hand-written SQL against INFORMATION_SCHEMA.TABLES returning unexpected TABLE_TYPE values; a driver returning empty or differently-cased/whitespace-padded strings.","solutions":["Update dbt-schemas to the latest version so new BigQuery table types are mapped","Trim the type string and verify exact values returned by BigQuery's INFORMATION_SCHEMA before passing them in","Patch/extend the match arm to map the new type (or contribute the mapping upstream)","As a stopgap, preprocess the string to a known value when you know the semantic equivalent"],"exampleFix":"// before\nlet rt = RelationType::from_adapter_type(AdapterType::Bigquery, raw_type);\n\n// after\nlet t = raw_type.trim().to_uppercase();\nlet known = [\"BASE TABLE\",\"CLONE\",\"SNAPSHOT\",\"TABLE\",\"VIEW\",\"MATERIALIZED VIEW\",\"MATERIALIZED_VIEW\",\"EXTERNAL\",\"FUNCTION\",\"AGGREGATE FUNCTION\"];\nassert!(known.contains(&t.as_str()), \"unmapped BigQuery table type: {raw_type}\");\nlet rt = RelationType::from_adapter_type(AdapterType::Bigquery, &t);","handlingStrategy":"validation","validationCode":"const BIGQUERY_KNOWN: &[&str] = &[\"BASE TABLE\",\"CLONE\",\"SNAPSHOT\",\"TABLE\",\"VIEW\",\"MATERIALIZED VIEW\",\"MATERIALIZED_VIEW\",\"EXTERNAL\",\"FUNCTION\",\"AGGREGATE FUNCTION\"];\nfn is_known_bigquery_type(t: &str) -> bool {\n    BIGQUERY_KNOWN.contains(&t.trim().to_uppercase().as_str())\n}","typeGuard":"fn valid_table_type(t: &str) -> Option<String> {\n    let u = t.trim().to_uppercase();\n    if u.is_empty() { None } else { Some(u) }\n}","tryCatchPattern":"let rt = std::panic::catch_unwind(|| RelationType::from_adapter_type(AdapterType::Bigquery, &t))\n    .map_err(|_| format!(\"unknown BigQuery table type: {t}\"))?;","preventionTips":["Normalize metadata strings (trim + uppercase) before mapping","Pin/query the latest dbt-schemas so new BigQuery types are covered","Log raw TABLE_TYPE values from information_schema to catch new kinds early","Add a unit test asserting all types your queries can return are mapped"],"tags":["rust","bigquery","relation-type","panic","schema-mapping"],"backgroundTag":"unsupported-enum-value","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}