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
Describe the bug
sqlfmt should always produce the same output on a given query, even when run multiple times. When this is not the case, we call this "unstable formatting".
There is an interaction between jinja expressions (and jinjafmt) and operators that is causing unstable formatting.
To Reproduce This file in the gitlab project has already been formatted by 0.8.0.
Run it through sqlfmt --diff
Expected behavior
sqlfmt should no-op
Actual behavior
--- source_query
+++ formatted_query
@@ -29,25 +29,38 @@
as dim_sales_qualified_source_id,
{{ get_keyed_nulls("order_type.dim_order_type_id") }} as dim_order_type_id
from {{ ref("sheetload_sales_funnel_targets_matrix_source") }}
- left join date on {{
+ left join
+ date
+ on
+ {{
sales_funnel_text_slugify(
"sheetload_sales_funnel_targets_matrix_source.month"
)
- }} = {{ sales_funnel_text_slugify("date.fiscal_month_name_fy") }}
- left join sales_qualified_source on {{
+ }}
+ = {{ sales_funnel_text_slugify("date.fiscal_month_name_fy") }}
+ left join
+ sales_qualified_source
+ on
+ {{
sales_funnel_text_slugify(
"sheetload_sales_funnel_targets_matrix_source.opportunity_source"
)
- }} = {{
+ }}
+ =
+ {{
sales_funnel_text_slugify(
"sales_qualified_source.sales_qualified_source_name"
)
}}
- left join order_type on {{
+ left join
+ order_type
+ on
+ {{
sales_funnel_text_slugify(
"sheetload_sales_funnel_targets_matrix_source.order_type"
)
- }} = {{ sales_funnel_text_slugify("order_type.order_type_name") }}
+ }}
+ = {{ sales_funnel_text_slugify("order_type.order_type_name") }}
),
fy22_user_hierarchy as (
@@ -94,11 +107,9 @@
from target_matrix
left join
fy22_user_hierarchy
- on {{ sales_funnel_text_slugify("target_matrix.area") }} = {{
- sales_funnel_text_slugify(
- "fy22_user_hierarchy.crm_opp_owner_area_stamped"
- )
- }}
+ on {{ sales_funnel_text_slugify("target_matrix.area") }}
+ =
+ {{ sales_funnel_text_slugify("fy22_user_hierarchy.crm_opp_owner_area_stamped") }}
where target_matrix.fiscal_year = 2022
union all
@@ -126,7 +137,8 @@
left join
fy23_and_beyond_user_hierarchy
on {{ sales_funnel_text_slugify("target_matrix.area") }}
- = {{
+ =
+ {{
sales_funnel_text_slugify(
"fy23_and_beyond_user_hierarchy.crm_opp_owner_sales_segment_geo_region_area_stamped"
)
Additional context
What is the output of sqlfmt --version?
0.8.0
The text was updated successfully, but these errors were encountered:
* fix: removing caching of node, line, comment props, which can cause issues when objects are mutated by jinjaformatter
* fix#175: add extra split before multiline jinja nodes
* fix: allow more merging of multiline jinja nodes
* chore: bump primer refs
Describe the bug
sqlfmt should always produce the same output on a given query, even when run multiple times. When this is not the case, we call this "unstable formatting".
There is an interaction between jinja expressions (and jinjafmt) and operators that is causing unstable formatting.
To Reproduce
This file in the gitlab project has already been formatted by 0.8.0.
Run it through
sqlfmt --diff
Expected behavior
sqlfmt should no-op
Actual behavior
Additional context
What is the output of
sqlfmt --version
?0.8.0
The text was updated successfully, but these errors were encountered: