Escape \ in columns descriptions

This commit is contained in:
Benoit Perigaud
2025-06-10 13:41:50 +02:00
parent a02aba8af8
commit dd6a20a8ae
3 changed files with 3 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ models:
enforced: true
columns:
- name: id
description: A multiline description containing example values that might\nbe held in this column. These examples include one with a format like something\Something\Another\Thing
data_type: "{{ 'UInt8' if target.type in ['clickhouse'] else 'int' }}"
constraints:
- type: not_null

View File

@@ -12,7 +12,7 @@ sources:
description: this is table 1.
columns:
- name: my_column
description: description for my source column
description: description for my source column with weird chars like \Something\Another\Thing
- name: table_2
- name: table_4
- name: table_5

View File

@@ -22,7 +22,7 @@
[
wrap_string_with_quotes(node.unique_id),
wrap_string_with_quotes(dbt.escape_single_quotes(column.name)),
wrap_string_with_quotes(dbt.escape_single_quotes(column.description)),
wrap_string_with_quotes(dbt.escape_single_quotes(column.description) | replace("\\","\\\\") ),
wrap_string_with_quotes(dbt.escape_single_quotes(column.data_type)),
wrap_string_with_quotes(dbt.escape_single_quotes(tojson(column.constraints))),
column.constraints | selectattr('type', 'equalto', 'not_null') | list | length > 0,