Skip to content

Unable to parse Snowflake FILE_FORMAT parameter USE_LOGICAL_TYPE #6637

@jjlkant

Description

@jjlkant

Search before asking

  • I searched the issues and found no similar issues.

What Happened

While trying to write a simple COPY INTO of a Parquet file into a Snowflake table, I ran into an unparsable section error from SQLFluff.

Expected Behaviour

I would have expected SQLFluff to be able to parse the valid Snowflake syntax and apply the selected configuration to the code.

Observed Behaviour

Given that this is valid Snowflake syntax capable of loading the data, I would not expect SQLFluff to find an unparsable section when the dialect is set to Snowflake

How to reproduce

A minimal example:

COPY INTO table_name
FROM '@stage/directory/filename.parquet'
FILE_FORMAT = (
    TYPE = PARQUET
    USE_LOGICAL_TYPE = TRUE
)
MATCH_BY_COLUMN_NAME = CASE_INSENSITIVE;

Returns the error:

Line 3, Position 1: Found unparsable section: 'FILE_FORMAT = (/n    TYPE = PARQUET/n    U...'

Dialect

Snowflake

Version

sqlfluff, version 3.3.1
Python 3.12.3

Configuration

[tool.sqlfluff.core]
dialect = "snowflake"
indent_unit = "space"
max_line_length = 100
runaway_limit = 10

[tool.sqlfluff.indentation]
allow_implicit_indents = true
tab_space_size = 4

[tool.sqlfluff.layout.type.comma]
line_position = "trailing"
spacing_before = "touch"

[tool.sqlfluff.rules.aliasing]
column = {aliasing = "explicit"}
expression = {allow_scalar = false}
length = {min_alias_length = 3}
table = {aliasing = "explicit"}

[tool.sqlfluff.rules.ambiguous.column_references]
group_by_and_order_by_style = "explicit"

[tool.sqlfluff.rules.capitalisation]
functions = {capitalisation_policy = "upper"}
identifiers = {extended_capitalisation_policy = "lower"}
keywords = {capitalisation_policy = "upper"}
literals = {capitalisation_policy = "upper"}
types = {extended_capitalisation_policy = "upper"}

[tool.sqlfluff.rules.convention]
not_equal = {preferred_not_equal_style = "c_style"}

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

    bugSomething isn't workingsnowflakeIssues related to the Snowflake dialect

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions