Describe the bug
We store json blobs within columns throughout our data pipeline. We'll then parse the JSON blob's field/values into their own columns in later stages. sqlfmt incorrectly lowercased the access path when retrieving data from the JSON blob. This lead to all accesses silently failing.
To Reproduce
Given the original snippet:
with test as (
select
cast(json:source_payload:orderId as varchar) as order_id,
from source
)
select *
from test
sqlfmt formats to:
with
test as (
select cast(json:source_payload:orderid as varchar) as order_id, from source
)
select *
from test
Note that orderId has become orderid. This is not a safe fix.
Expected behavior
Only safe formatting fixes should be performed.
Describe the bug We store json blobs within columns throughout our data pipeline. We'll then parse the JSON blob's field/values into their own columns in later stages. sqlfmt incorrectly lowercased the access path when retrieving data from the JSON blob. This lead to all accesses silently failing.
To Reproduce Given the original snippet:
sqlfmt formats to:
Note that
orderId
has becomeorderid
. This is not a safe fix.Expected behavior Only safe formatting fixes should be performed.
Actual behavior The json access path is broken.
Additional context sqlfmt, version 0.21.2