Skip to content

[Bug]: Unexpected Exception #2464

@raphi1790

Description

@raphi1790

What happened?

sqruff-Version: 0.36.1
templater: dbt
dialect: bigquery

What happened

{{ config(
    materialized='table'
)
}}

with raw_data as (
    select * from {{ source('<connection_name>', '<table_name>') }}
               )
select
    *
from raw_data

where there is a source file

version: 2

sources:
  - name: <connection_name>
    database: <connection> # GCP project
    schema: <dataset>  # BigQuery dataset
    tables:
      - name: <table_name>

When running sqruff lint <file_path> I get the following error

thread '<unnamed>' (30317297) panicked at crates/lib/src/utils/reflow/elements.rs:272:22:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
== ... FAIL
L:   1 | P:   1 | ???? | Unexpected exception. Could you open an issue at
                       | https://github.com/quarylabs/sqruff
The linter processed 1 file(s).
All Finished 📜 🎉

There are two interesting points:
When I remove the config-Block ({{ config( materialized='table' ) }} The linting works without an error.

The error only occurs if the source is coming from another GCP-Project. Sources within the same project don't fail.

Version

No response

Checked in Playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions