dbt-labs / dbt-labs/dbt

[Feature] Static analysis support for BigQuery ML/AI inference table functions with MODEL arguments (ML.PREDICT, AI.*)

Open
#15,533 2 comments 2 reactions 0 assignees View on GitHub
area:static-analysis engine:v2 triage
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

Description

### Is this your first time submitting a feature request?

- [x] I have read the [expectations for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations)
- [x] I have searched the existing issues, and I could not find an existing issue for this feature
- [x] I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

### Which version of dbt is this feature for?

dbt v2.x (Core or Fusion)

### Describe the feature

#13740 fixed the crash when compiling BigQuery ML inference table functions like ML.PREDICT that take a MODEL argument static analysis now emits a clear, actionable error instead of the cryptic dbt0101 parse failure:

▎ [UnsupportedFeature (dbt0255)]: Fusion does not currently support static analysis for BigQuery ML inference table functions (e.g. ML.PREDICT) that take a MODEL argument, because the output schema depends
▎ on the model. To work around, set static_analysis = 'off' for this model.

That's a real improvement but it doesn't add support for these functions. Models using ML.PREDICT, ML.FORECAST, etc. still can't use static analysis at all and have to fall back to static_analysis = 'off'.

I want to request a real static analysis support for these functions so static_analysis = 'off' isn't required, since this cascades and disables static analysis on so many downstream models as well.

A related case: AI.DETECT_ANOMALIES (and likely other AI.* inference functions) hits the same issue as ML.* did before #13740

### Describe alternatives you've considered

static_analysis = off is currently my only alternative but that disables static analysis for the models and all downstream models.

### Who will this benefit?

Anyone using BigQuery ML or the newer BigQuery AI functions (ML.PREDICT, ML.FORECAST, AI.DETECT_ANOMALIES, etc.) inside dbt models with static analysis enabled. These inline ml/ai functions are becoming more popular.

### Are you interested in contributing this feature?

Yes but I think this is behind the closed source part of the project.

### Anything else?

- Follow-up to #13740
- Related: AI.* inference functions (e.g. AI.DETECT_ANOMALIES) hit a separate dbt0252 error under the same root cause (output schema depends on a model/argument-driven callable)
- Would file as a sub-issue of the BigQuery epic (#14391), labeled adapter:bigquery, engine:v2 in addition to the template's default enhancement/triage

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.