Skip to content

Support Request: RF01 rule #6033

@nhammad

Description

@nhammad

Search before asking

  • I searched the issues and found no similar issues.

Description

It seems sqlfluff can’t handle the dot notation we use for Redshift SUPER data type. RF01 rule (https://docs.sqlfluff.com/en/stable/rules.html#rule-references.from).

Usage example:

w_extract as (
    select
        pj.hash_key,
        pj.snapshot_date,
        trim(cast(pj.metadata_super."amount" as numeric))                                       as amount,
        trim(cast(pj.metadata_super."leadAge" as numeric))                                      as lead_age,
        trim(cast(pj.metadata_super."leadType" as varchar))                                     as lead_type,
        trim(cast(pj.metadata_super."leadValue" as numeric))                                    as lead_value,
        trim(cast(pj.metadata_super."randValue" as numeric))                                    as rand_value,
        trim(cast(pj.metadata_super."callReason" as varchar))                                   as call_reason
    from w_parse_json as pj
)

Failures:

L:  49 | P:  22 | RF01 | Reference 'pj.metadata_super."amount"' refers to
                       | table/view not found in the FROM clause or found in
                       | ancestor statement. [references.from]
L:  50 | P:  22 | RF01 | Reference 'pj.metadata_super."leadAge"' refers to
                       | table/view not found in the FROM clause or found in
                       | ancestor statement. [references.from]
L:  51 | P:  22 | RF01 | Reference 'pj.metadata_super."leadType"' refers to
                       | table/view not found in the FROM clause or found in
                       | ancestor statement. [references.from]
L:  52 | P:  22 | RF01 | Reference 'pj.metadata_super."leadValue"' refers to
                       | table/view not found in the FROM clause or found in
                       | ancestor statement. [references.from]
L:  53 | P:  22 | RF01 | Reference 'pj.metadata_super."randValue"' refers to
                       | table/view not found in the FROM clause or found in
                       | ancestor statement. [references.from]
L:  54 | P:  22 | RF01 | Reference 'pj.metadata_super."callReason"' refers to
                       | table/view not found in the FROM clause or found in
                       | ancestor statement. [references.from]

Can we improve this so this is automatically handled via sqlfluff fix? Currently, this is an unfixable violation and we simply have to ignore it.

Use case

No response

Dialect

Are you willing to work on and submit a PR to address the issue?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions