dbt-labs / dbt-labs/dbt

[v2 Bug] [Snowflake] static_analysis: strict raises dbt0214 TableNotFound for sources in catalog-linked databases

Open
#15,577 2 comments 0 reactions 1 assignee Claimed by @mengdilin-dev View on GitHub
adapter:snowflake area:catalog-v2 area:engine engine:v2 proj:catalog-v2 triage type:bug
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

Description

## Is this a new bug?

- [x] I believe this is a new bug
- [x] I have searched existing issues and could not find a duplicate

## Current Behavior

When `static_analysis: strict` is enabled globally, `dbt compile` raises `dbt0214 TableNotFound` errors for **sources that live in Snowflake catalog-linked databases** (kind: `CATALOG-LINKED DATABASE`). The errors block compilation entirely for those models.

Example error:
```
dbt0214 TableNotFound: Table 'MY_CLD_DATABASE.MY_SCHEMA.my_table' is missing in remote
```

## Expected Behavior

Fusion should resolve source table schemas for catalog-linked databases without raising `dbt0214`. Sources that are queryable at runtime should be resolvable at compile time.

## Steps to Reproduce

1. Configure a Snowflake connection with access to a catalog-linked database containing Iceberg tables.
2. Define sources in `sources.yml` pointing to schemas in that database.
3. Set `static_analysis: strict` globally in `dbt_project.yml`.
4. Run `dbt compile`.

**Result:** `dbt0214 TableNotFound` errors for all sources in catalog-linked databases.

## Affected Databases

All affected databases are of kind `CATALOG-LINKED DATABASE` (confirmed via `SHOW DATABASES`). Standard Snowflake databases resolve correctly — only catalog-linked databases exhibit this behavior.

## Investigation Notes (as of 2026-07-22)

`INFORMATION_SCHEMA.COLUMNS` is **populated** for all affected schemas, queried as the same role used by local `dbt compile`:

| Database | Schema | Column count |
|---|---|---|
| `MY_CLD_DATABASE_1` | `MY_SCHEMA_1` | 88 |
| `MY_CLD_DATABASE_1` | `MY_SCHEMA_2` | 403 |
| `MY_CLD_DATABASE_1` | `MY_SCHEMA_3` | 35,935 |
| `MY_CLD_DATABASE_2` | `MY_SCHEMA_4` | 1,144 |
| `MY_CLD_DATABASE_2` | `MY_SCHEMA_5` | 620 |
| `MY_CLD_DATABASE_3` | `MY_SCHEMA_6` | 19 |
| `MY_CLD_DATABASE_3` | `MY_SCHEMA_7` | 119 |
| `MY_CLD_DATABASE_3` | `MY_SCHEMA_8` | 383 |

Individual tables are also directly queryable (e.g. `SELECT COUNT(*) FROM MY_CLD_DATABASE_1.MY_SCHEMA_2.my_table` returns rows). Despite this, `dbt0214` errors persist under `static_analysis: strict`.

The root cause — specifically how Fusion reads or matches schema metadata for catalog-linked databases — has not been determined.

## Current Workaround

Apply `static_analysis: baseline` suppressions in `dbt_project.yml` for all model paths sourcing from affected databases:

```yaml
models:
my_project:
staging_area:
+static_analysis: baseline
```

This unblocks compilation but loses strict static analysis coverage for those paths — no column-level lineage, reduced IDE diagnostics, and no early error detection.

## Environment

- **Adapter:** Snowflake
- **Engine:** v2 (Fusion)
- **Static analysis mode:** `strict`
- **dbt version:** 2.0.0-preview.200 (originally filed on 2.0.0-beta.199)

## Related Issues

- #12353: `dbt compile` fails with REST Catalog-Linked database (different error, same underlying area — CLOSED)
- #13950: Two-part object names not recognized by static analysis (different bug, same `area:static-analysis`)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.