dataform icon indicating copy to clipboard operation
dataform copied to clipboard

[Bug] Ending a `description` block with a single quote causes compile errors in production

Open HHammond opened this issue 7 months ago • 1 comments

Kind of an odd one, I usually wrap my descriptions in backticks. My latest one ended with a single ' character which caused the model to fail.

The model fine with dataform run --actions 'my_action' but failed in production. Running a model locally does not render the description block, but running it in production dataform does.

Here's a minimal example to trigger the issue

config {
  type: "view",
  description: `Description that ends with '`
}
SELECT 1

And here's a trimmed output that it compiles to:

            CREATE OR REPLACE VIEW `foo.my_view`
    OPTIONS(description='''Description that ends with '''')
                                                      ^^^^ ends the descrption and opens a new string literal

I suspect adding triple quotes inside the block triggers the same failure path, but I haven't tested it.

HHammond avatar Jun 26 '25 13:06 HHammond

You should be able to escape it with a backslash like :

 description: `Description that ends with \'`

More details on escaping characters in BQ: https://cloud.google.com/bigquery/docs/reference/legacy-sql#stringfunctions

Ceridan avatar Jun 27 '25 09:06 Ceridan