forked from tconbeer/sqlfmt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix tconbeer#471: handle nested dictionary in jinja expression
- Loading branch information
1 parent
c2c5fc7
commit 6d43942
Showing
10 changed files
with
359 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
tests/data/unit_tests/test_nested_dictionary/test_false_positive.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- this could be a nested dictionary, since it contains `"}}` | ||
{{"foo"}} | ||
)))))__SQLFMT_OUTPUT__((((( | ||
-- this could be a nested dictionary, since it contains `"}}` | ||
{{ "foo" }} |
37 changes: 37 additions & 0 deletions
37
tests/data/unit_tests/test_nested_dictionary/test_nested_dictionary.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
-- source: https://github.com/tconbeer/sqlfmt/issues/471 | ||
{{ | ||
config( | ||
materialized='incremental', | ||
incremental_strategy='insert_overwrite', | ||
external_location=generate_external_location("baz", "datalake/producer=foo/object=bar"), | ||
partitioned_by=['batch_date'], | ||
lf_tags_config={ | ||
'enabled': true, | ||
'tags': { | ||
'domain': 'foo', | ||
'sensitivity': 'public' | ||
} | ||
} | ||
) | ||
}} | ||
select | ||
batch_date | ||
from | ||
{{ ref('bar') }} | ||
{% if is_incremental() %} | ||
where batch_date = '{{ var("ds") }}' | ||
{% endif %} | ||
)))))__SQLFMT_OUTPUT__((((( | ||
-- source: https://github.com/tconbeer/sqlfmt/issues/471 | ||
{{ | ||
config( | ||
materialized="incremental", | ||
incremental_strategy="insert_overwrite", | ||
external_location=generate_external_location("baz", "datalake/producer=foo/object=bar"), | ||
partitioned_by=["batch_date"], | ||
lf_tags_config={"enabled": true, "tags": {"domain": "foo", "sensitivity": "public"}}, | ||
) | ||
}} | ||
select batch_date | ||
from {{ ref("bar") }} | ||
{% if is_incremental() %} where batch_date = '{{ var("ds") }}' {% endif %} |
41 changes: 41 additions & 0 deletions
41
tests/data/unit_tests/test_nested_dictionary/test_triple_nested_single_quote_100.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{{ | ||
config( | ||
materialized='incremental', | ||
incremental_strategy='insert_overwrite', | ||
external_location=generate_external_location('baz', 'datalake/producer=foo/object=bar'), | ||
partitioned_by=['batch_date'], | ||
lf_tags_config={ | ||
'enabled': true, | ||
'tags': { | ||
'nested_layer_0': | ||
{'nested_layer_1': | ||
{'nested_layer_2':{'foo':'bar'}}}, | ||
'domain': 'foo', | ||
'sensitivity': 'public', | ||
}, | ||
}, | ||
) | ||
}} | ||
select batch_date | ||
from {{ ref("bar") }} | ||
{% if is_incremental() %} where batch_date = '{{ var("ds") }}' {% endif %} | ||
)))))__SQLFMT_OUTPUT__((((( | ||
{{ | ||
config( | ||
materialized="incremental", | ||
incremental_strategy="insert_overwrite", | ||
external_location=generate_external_location("baz", "datalake/producer=foo/object=bar"), | ||
partitioned_by=["batch_date"], | ||
lf_tags_config={ | ||
"enabled": true, | ||
"tags": { | ||
"nested_layer_0": {"nested_layer_1": {"nested_layer_2": {"foo": "bar"}}}, | ||
"domain": "foo", | ||
"sensitivity": "public", | ||
}, | ||
}, | ||
) | ||
}} | ||
select batch_date | ||
from {{ ref("bar") }} | ||
{% if is_incremental() %} where batch_date = '{{ var("ds") }}' {% endif %} |
45 changes: 45 additions & 0 deletions
45
tests/data/unit_tests/test_nested_dictionary/test_triple_nested_single_quote_88.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{{ | ||
config( | ||
materialized='incremental', | ||
incremental_strategy='insert_overwrite', | ||
external_location=generate_external_location('baz', 'datalake/producer=foo/object=bar'), | ||
partitioned_by=['batch_date'], | ||
lf_tags_config={ | ||
'enabled': true, | ||
'tags': { | ||
'nested_layer_0': | ||
{'nested_layer_1': | ||
{'nested_layer_2':{'foo':'bar'}}}, | ||
'domain': 'foo', | ||
'sensitivity': 'public', | ||
}, | ||
}, | ||
) | ||
}} | ||
select batch_date | ||
from {{ ref("bar") }} | ||
{% if is_incremental() %} where batch_date = '{{ var("ds") }}' {% endif %} | ||
)))))__SQLFMT_OUTPUT__((((( | ||
{{ | ||
config( | ||
materialized="incremental", | ||
incremental_strategy="insert_overwrite", | ||
external_location=generate_external_location( | ||
"baz", "datalake/producer=foo/object=bar" | ||
), | ||
partitioned_by=["batch_date"], | ||
lf_tags_config={ | ||
"enabled": true, | ||
"tags": { | ||
"nested_layer_0": { | ||
"nested_layer_1": {"nested_layer_2": {"foo": "bar"}} | ||
}, | ||
"domain": "foo", | ||
"sensitivity": "public", | ||
}, | ||
}, | ||
) | ||
}} | ||
select batch_date | ||
from {{ ref("bar") }} | ||
{% if is_incremental() %} where batch_date = '{{ var("ds") }}' {% endif %} |
Oops, something went wrong.