You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Ending a description block with a single quote causes compile errors in production #1990
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.
I reproduced this on the managed service (@dataform/core 3.0.52). It's a bug in the managed Google Cloud Dataform service, not in this repo.
Core compiles correctly. The compiled action's relationDescriptor.description holds the exact string Description that ends with '.
The managed service breaks it at execution time. It inserts the description into OPTIONS(description='''...''') without escaping it, which yields '''Description that ends with '''' and Syntax error: Unclosed string literal.
Other descriptions fail too. A description containing ''' fails (Unexpected identifier), and one containing a backslash fails (Illegal escape sequence). A backslash that forms a valid escape (\n) silently changes the stored text.
The tested column description ending in ' was stored correctly. I didn't test other characters in column descriptions.
The CLI is unaffected.dataform run sets the table description through the BigQuery tables API instead of SQL (setMetadata in cli/api/dbadapters/bigquery.ts). That's why it works locally and fails in production.
About the workaround suggested above: in a JS template literal, `\'` is just ', so it fails the same way (I tested it). `ends with \\'` does make the managed run succeed, because BigQuery unescapes \'. But the CLI then stores a literal backslash, so it's only worth using if you never run with the CLI. Another option is to avoid a trailing ', for example by ending with a space or a period.
The fix is to have the service emit a normal escaped literal ("..." with \\, \", \n and similar), as quoteBigQueryString in core/actions/property_graph_utils.ts already does. I checked that this round-trips exactly on BigQuery for all the cases above, plus "/""", multi-line text, Unicode and control characters. The fix is in Google's service code rather than this repo, so I've filed it on the Google Issue Tracker: https://issuetracker.google.com/issues/584370943. It's related to the earlier, now-fixed issue 288350498 (escape characters in the query body breaking incremental runs).
Activity
Ceridan commentedon Jun 27, 2025
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
dmargol1 commentedon Nov 11, 2026
I reproduced this on the managed service (@dataform/core 3.0.52). It's a bug in the managed Google Cloud Dataform service, not in this repo.
relationDescriptor.descriptionholds the exact stringDescription that ends with '.OPTIONS(description='''...''')without escaping it, which yields'''Description that ends with ''''andSyntax error: Unclosed string literal.'''fails (Unexpected identifier), and one containing a backslash fails (Illegal escape sequence). A backslash that forms a valid escape (\n) silently changes the stored text.'was stored correctly. I didn't test other characters in column descriptions.dataform runsets the table description through the BigQuery tables API instead of SQL (setMetadataincli/api/dbadapters/bigquery.ts). That's why it works locally and fails in production.About the workaround suggested above: in a JS template literal,
`\'`is just', so it fails the same way (I tested it).`ends with \\'`does make the managed run succeed, because BigQuery unescapes\'. But the CLI then stores a literal backslash, so it's only worth using if you never run with the CLI. Another option is to avoid a trailing', for example by ending with a space or a period.The fix is to have the service emit a normal escaped literal (
"..."with\\,\",\nand similar), asquoteBigQueryStringincore/actions/property_graph_utils.tsalready does. I checked that this round-trips exactly on BigQuery for all the cases above, plus"/""", multi-line text, Unicode and control characters. The fix is in Google's service code rather than this repo, so I've filed it on the Google Issue Tracker: https://issuetracker.google.com/issues/584370943. It's related to the earlier, now-fixed issue 288350498 (escape characters in the query body breaking incremental runs).rafal-hawrylak commentedon Nov 12, 2026
Thanks @dmargol1, confirmed. The description is not escaped on the Cloud Dataform side. We are tracking the fix internally.