dbt-labs / dbt-labs/dbt

[BUG][Databricks] - Missing syntax: `WITH RECURSIVE`

Open
#14,130 0 comments 0 reactions 0 assignees View on GitHub
adapter:databricks area:static-analysis engine:v2 status:needs-repro status:triage type:bug
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

Description

**Describe the bug**
Fusion is not aware of recursive CTE's in databricks and throws:
```sh
error: dbt0101: no viable alternative at input 'WITH RECURSIVE recursive_cte'
--> models/marts/recursive_cte.sql:1:16 (target/compiled/models/marts/recursive_cte.sql:1:16)
```

**What version of dbt Fusion is this bug in? (find out by running `dbt --version`)**
preview.92

**Is this a discrepancy between the dbt Fusion Engine and dbt Core? Check one.**
- [X] YES
- [ ] NO

**To Reproduce**
```sql
-- my_model.sql
WITH RECURSIVE recursive_cte(n) AS (
SELECT 1
UNION ALL
SELECT n + 1 FROM recursive_cte WHERE n < 5
)
SELECT * FROM recursive_cte
```

**Expected behaviour**
Fusion respects this functionality as valid SQL for Databricks

**Operating System and CPU Type (please complete the following information):**
* Mac ARM

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.