dbt-project-evaluator icon indicating copy to clipboard operation
dbt-project-evaluator copied to clipboard

Multiline column descriptions result in unclosed string literals

Open katieclaiborne opened this issue 5 months ago • 4 comments

Describe the bug

In BigQuery, the new base_<node/source>_columns models fail with a syntax error when a multiline column description is present.

Steps to reproduce

Take a single line description, and convert to a multiline description using block notation.

description: >
  My column description

Expected results

I expected dbt project evaluator to run without issue.

Actual results

Instead, the new base_<node/source>_columns models failed with "Unclosed string literal" syntax errors.

Screenshots and log output

Inspecting the failed BigQuery job shows that it is interpreting the multiline string as unclosed individual strings.

image

System information

The contents of your packages.yml file:

packages:
  - package: dbt-labs/dbt_project_evaluator
    version: [">=0.9.0", "<0.10.0"]

Which database are you using dbt with?

  • [ ] postgres
  • [ ] redshift
  • [x] bigquery
  • [ ] snowflake
  • [ ] trino/starburst
  • [ ] other (specify: ____________)

The output of dbt --version: I don't have ready access to the CLI at the moment, but these are the versions listed at the start of a Cloud IDE invocation.

dbt=1.6.9, dbt-bigquery=1.6.9

Additional context

I think I've traced the issue to the active line in the wrap_string_with_quotes macro.

It seems like you all are trying to move away from the macro in #419, but I don't know whether dbt.string_literal has a triple-quoting option to support multiline BigQuery strings.

Are you interested in contributing the fix?

Yes! I've played around in #420, and have confirmed that it resolves the issue in our own project.

katieclaiborne avatar Feb 04 '24 20:02 katieclaiborne