littleK0i / SnowDDL

Declarative database change management tool for Snowflake
Apache License 2.0
104 stars 27 forks source link

View Converter Fails There Is A Comment #108

Closed nickshffer closed 2 months ago

nickshffer commented 6 months ago

If a view has a comment then the converter will not properly parse the ddl.

The regex statement for parsing the view definition fails to find any matches if the view has a comment (which would come between the closing paren of the column defs and the \sas .

As a result, view_text is in effect the full body of the view ddl, which causes:

...
(
    message   =>  SQL compilation error:
syntax error line 18 at position 0 unexpected 'create'.
...
littleK0i commented 6 months ago

Please try 0.28.2. I've relaxed view parsing regexp a bit.

Unfortunately, there seems to be no way of getting "pure" SQL query text from Snowflake metadata, so current methods are prone to parsing errors.