dbt-labs / dbt-labs/dbt-autofix
str.format() doesn't work in dbt Fusion
- Dominant language
- Python
- Stars
- 88
- Forks
- 19
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 13
Description
To be clear, not an issue with `dbt-autofix`, not sure if this is a known deprecation vs bug in dbt Fusion
`{{ str.format(i) }}` doesn't work in dbt Fusion, alternatives like ` {{ "%s" % i }}` do work.
Examples with `dbt-core 1.11.11` and `dbt-fusion 2.0.0-preview.189`
Using str.format:
```sql
select
{% for i in [0, 1, 2, 10, 11, 12] -%}
{{ '{:02}'.format(i) }},
{%- endfor %}
```
```sql
-- dbt-core
select
00,01,02,10,11,12,
```
```sql
-- dbt Fusion
select
{:02},{:02},{:02},{:02},{:02},{:02},
```
Using [% printf style formatting](https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting):
```sql
select
{% for i in [0, 1, 2, 10, 11, 12] -%}
{{ "%02d" % i }},
{%- endfor %}
```
```sql
-- dbt-core
select
00,01,02,10,11,12,
```
```sql
-- dbt Fusion
select
00,01,02,10,11,12,
```
Contributor guide
Assessment
This issue has not been assessed yet.