mirror of
https://github.com/dbt-labs/dbt-project-evaluator.git
synced 2025-12-18 02:11:27 +00:00
replace wrap_string_with_quotes with dbt.string_literal
This commit is contained in:
@@ -20,11 +20,11 @@
|
||||
|
||||
{%- set values_line =
|
||||
[
|
||||
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.data_type)),
|
||||
wrap_string_with_quotes(dbt.escape_single_quotes(column.quote))
|
||||
dbt.string_literal(node.unique_id),
|
||||
dbt.string_literal(dbt.escape_single_quotes(column.name)),
|
||||
dbt.string_literal(dbt.escape_single_quotes(column.description)),
|
||||
dbt.string_literal(dbt.escape_single_quotes(column.data_type)),
|
||||
dbt.string_literal(dbt.escape_single_quotes(column.quote))
|
||||
]
|
||||
%}
|
||||
|
||||
|
||||
@@ -13,18 +13,18 @@
|
||||
|
||||
{%- set values_line =
|
||||
[
|
||||
wrap_string_with_quotes(node.unique_id),
|
||||
wrap_string_with_quotes(node.name),
|
||||
wrap_string_with_quotes(node.resource_type),
|
||||
wrap_string_with_quotes(node.original_file_path | replace("\\","\\\\")),
|
||||
dbt.string_literal(node.unique_id),
|
||||
dbt.string_literal(node.name),
|
||||
dbt.string_literal(node.resource_type),
|
||||
dbt.string_literal(node.original_file_path | replace("\\","\\\\")),
|
||||
"cast(" ~ dbt_project_evaluator.is_not_empty_string(node.description) | trim ~ " as boolean)",
|
||||
wrap_string_with_quotes(node.type),
|
||||
wrap_string_with_quotes(node.maturity),
|
||||
wrap_string_with_quotes(node.package_name),
|
||||
wrap_string_with_quotes(node.url),
|
||||
wrap_string_with_quotes(dbt.escape_single_quotes(node.owner.name)),
|
||||
wrap_string_with_quotes(dbt.escape_single_quotes(node.owner.email)),
|
||||
wrap_string_with_quotes(node.meta | tojson)
|
||||
dbt.string_literal(node.type),
|
||||
dbt.string_literal(node.maturity),
|
||||
dbt.string_literal(node.package_name),
|
||||
dbt.string_literal(node.url),
|
||||
dbt.string_literal(dbt.escape_single_quotes(node.owner.name)),
|
||||
dbt.string_literal(dbt.escape_single_quotes(node.owner.email)),
|
||||
dbt.string_literal(node.meta | tojson)
|
||||
]
|
||||
%}
|
||||
|
||||
|
||||
@@ -12,23 +12,23 @@
|
||||
|
||||
{%- set values_line =
|
||||
[
|
||||
wrap_string_with_quotes(node.unique_id),
|
||||
wrap_string_with_quotes(node.name),
|
||||
wrap_string_with_quotes(node.resource_type),
|
||||
wrap_string_with_quotes(node.original_file_path | replace("\\","\\\\")),
|
||||
dbt.string_literal(node.unique_id),
|
||||
dbt.string_literal(node.name),
|
||||
dbt.string_literal(node.resource_type),
|
||||
dbt.string_literal(node.original_file_path | replace("\\","\\\\")),
|
||||
"cast(" ~ dbt_project_evaluator.is_not_empty_string(node.description) | trim ~ " as boolean)",
|
||||
wrap_string_with_quotes(node.type),
|
||||
wrap_string_with_quotes(dbt.escape_single_quotes(node.label)),
|
||||
wrap_string_with_quotes(node.package_name),
|
||||
wrap_string_with_quotes(node.filter | tojson),
|
||||
wrap_string_with_quotes(node.type_params.measure.name),
|
||||
wrap_string_with_quotes(node.type_params.measure.alias),
|
||||
wrap_string_with_quotes(node.type_params.numerator | tojson),
|
||||
wrap_string_with_quotes(node.type_params.denominator | tojson),
|
||||
wrap_string_with_quotes(node.type_params.expr),
|
||||
wrap_string_with_quotes(node.type_params.window | tojson),
|
||||
wrap_string_with_quotes(node.type_params.grain_to_date),
|
||||
wrap_string_with_quotes(node.meta | tojson)
|
||||
dbt.string_literal(node.type),
|
||||
dbt.string_literal(dbt.escape_single_quotes(node.label)),
|
||||
dbt.string_literal(node.package_name),
|
||||
dbt.string_literal(node.filter | tojson),
|
||||
dbt.string_literal(node.type_params.measure.name),
|
||||
dbt.string_literal(node.type_params.measure.alias),
|
||||
dbt.string_literal(node.type_params.numerator | tojson),
|
||||
dbt.string_literal(node.type_params.denominator | tojson),
|
||||
dbt.string_literal(node.type_params.expr),
|
||||
dbt.string_literal(node.type_params.window | tojson),
|
||||
dbt.string_literal(node.type_params.grain_to_date),
|
||||
dbt.string_literal(node.meta | tojson)
|
||||
]
|
||||
%}
|
||||
|
||||
|
||||
@@ -17,28 +17,28 @@
|
||||
|
||||
{%- set values_line =
|
||||
[
|
||||
wrap_string_with_quotes(node.unique_id),
|
||||
wrap_string_with_quotes(node.name),
|
||||
wrap_string_with_quotes(node.resource_type),
|
||||
wrap_string_with_quotes(node.original_file_path | replace("\\","\\\\")),
|
||||
dbt.string_literal(node.unique_id),
|
||||
dbt.string_literal(node.name),
|
||||
dbt.string_literal(node.resource_type),
|
||||
dbt.string_literal(node.original_file_path | replace("\\","\\\\")),
|
||||
"cast(" ~ node.config.enabled | trim ~ " as boolean)",
|
||||
wrap_string_with_quotes(node.config.materialized),
|
||||
wrap_string_with_quotes(node.config.on_schema_change),
|
||||
wrap_string_with_quotes(node.group),
|
||||
wrap_string_with_quotes(node.access),
|
||||
wrap_string_with_quotes(node.latest_version),
|
||||
dbt.string_literal(node.config.materialized),
|
||||
dbt.string_literal(node.config.on_schema_change),
|
||||
dbt.string_literal(node.group),
|
||||
dbt.string_literal(node.access),
|
||||
dbt.string_literal(node.latest_version),
|
||||
"cast(" ~ contract | trim ~ " as boolean)",
|
||||
node.columns.values() | list | length,
|
||||
node.columns.values() | list | selectattr('description') | list | length,
|
||||
wrap_string_with_quotes(node.database),
|
||||
wrap_string_with_quotes(node.schema),
|
||||
wrap_string_with_quotes(node.package_name),
|
||||
wrap_string_with_quotes(node.alias),
|
||||
dbt.string_literal(node.database),
|
||||
dbt.string_literal(node.schema),
|
||||
dbt.string_literal(node.package_name),
|
||||
dbt.string_literal(node.alias),
|
||||
"cast(" ~ dbt_project_evaluator.is_not_empty_string(node.description) | trim ~ " as boolean)",
|
||||
"''" if not node.column_name else wrap_string_with_quotes(dbt.escape_single_quotes(node.column_name)),
|
||||
wrap_string_with_quotes(node.meta | tojson),
|
||||
wrap_string_with_quotes(dbt.escape_single_quotes(hard_coded_references)),
|
||||
wrap_string_with_quotes(node.get('depends_on',{}).get('macros',[]) | tojson),
|
||||
"''" if not node.column_name else dbt.string_literal(dbt.escape_single_quotes(node.column_name)),
|
||||
dbt.string_literal(node.meta | tojson),
|
||||
dbt.string_literal(dbt.escape_single_quotes(hard_coded_references)),
|
||||
dbt.string_literal(node.get('depends_on',{}).get('macros',[]) | tojson),
|
||||
"cast(" ~ dbt_project_evaluator.is_not_empty_string(node.test_metadata) | trim ~ " as boolean)",
|
||||
"cast(" ~ exclude_node ~ " as boolean)",
|
||||
]
|
||||
|
||||
@@ -14,22 +14,22 @@
|
||||
|
||||
{%- set values_line =
|
||||
[
|
||||
wrap_string_with_quotes(node.unique_id),
|
||||
wrap_string_with_quotes(node.name),
|
||||
wrap_string_with_quotes(node.original_file_path | replace("\\","\\\\")),
|
||||
wrap_string_with_quotes(node.alias),
|
||||
wrap_string_with_quotes(node.resource_type),
|
||||
wrap_string_with_quotes(node.source_name),
|
||||
dbt.string_literal(node.unique_id),
|
||||
dbt.string_literal(node.name),
|
||||
dbt.string_literal(node.original_file_path | replace("\\","\\\\")),
|
||||
dbt.string_literal(node.alias),
|
||||
dbt.string_literal(node.resource_type),
|
||||
dbt.string_literal(node.source_name),
|
||||
"cast(" ~ dbt_project_evaluator.is_not_empty_string(node.source_description) | trim ~ " as boolean)",
|
||||
"cast(" ~ dbt_project_evaluator.is_not_empty_string(node.description) | trim ~ " as boolean)",
|
||||
"cast(" ~ node.config.enabled ~ " as boolean)",
|
||||
wrap_string_with_quotes(node.loaded_at_field | replace("'", "_")),
|
||||
wrap_string_with_quotes(node.database),
|
||||
wrap_string_with_quotes(node.schema),
|
||||
wrap_string_with_quotes(node.package_name),
|
||||
wrap_string_with_quotes(node.loader),
|
||||
wrap_string_with_quotes(node.identifier),
|
||||
wrap_string_with_quotes(node.meta | tojson),
|
||||
dbt.string_literal(node.loaded_at_field | replace("'", "_")),
|
||||
dbt.string_literal(node.database),
|
||||
dbt.string_literal(node.schema),
|
||||
dbt.string_literal(node.package_name),
|
||||
dbt.string_literal(node.loader),
|
||||
dbt.string_literal(node.identifier),
|
||||
dbt.string_literal(node.meta | tojson),
|
||||
"cast(" ~ exclude_source ~ " as boolean)",
|
||||
]
|
||||
%}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{% macro wrap_string_with_quotes(str) %}
|
||||
{% if not str %}
|
||||
{{ return('cast(NULL as ' ~ dbt.type_string() ~ ')') }}
|
||||
{% else %}
|
||||
{{ return("'" ~ str ~ "'") }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
@@ -8,7 +8,7 @@
|
||||
{%- endfor %}
|
||||
{%- endfor -%}
|
||||
|
||||
{%- set quoted_directory_pattern = wrap_string_with_quotes(get_directory_pattern()) %}
|
||||
{%- set quoted_directory_pattern = dbt.string_literal(get_directory_pattern()) %}
|
||||
|
||||
with unioned as (
|
||||
|
||||
|
||||
@@ -13,6 +13,6 @@ with vars_folders_table as (
|
||||
|
||||
select
|
||||
var_name as folder_name,
|
||||
{{ dbt.replace('var_name', wrap_string_with_quotes(suffix_folder), "''") }} as model_type,
|
||||
{{ dbt.replace('var_name', dbt.string_literal(suffix_folder), "''") }} as model_type,
|
||||
var_value as folder_name_value
|
||||
from vars_folders_table
|
||||
|
||||
@@ -15,7 +15,7 @@ parsed as (
|
||||
|
||||
select
|
||||
var_name as prefix_name,
|
||||
{{ dbt.replace('var_name', wrap_string_with_quotes(suffix_model_type) , "''") }} as model_type,
|
||||
{{ dbt.replace('var_name', dbt.string_literal(suffix_model_type) , "''") }} as model_type,
|
||||
var_value as prefix_value
|
||||
from vars_prefix_table
|
||||
|
||||
|
||||
Reference in New Issue
Block a user