nrempel / sleek

Sleek is a CLI tool for formatting SQL. It helps you maintain a consistent style across your SQL code, enhancing readability and productivity.
MIT License
149 stars 9 forks source link

Sleek breaks scientific notation #72

Open BenQuigley opened 3 months ago

BenQuigley commented 3 months ago

I've been using this and it's a great SQL formatter, working better for my particular use case than several others I have tried. However, I noticed today that numbers in scientific notation aren't supported. Consider the file example.sql:

SELECT
    1.3e6 AS thirteen_hundred_thousand

That's valid in presto sql / amazon athena, at least; it evaluates to a double 130000.0. However, sleek 0.3.0 (called with no args) breaks this example script, reformatting it to:

SELECT
    1.3 e6 AS thirteen_hundred_thousand

which then errors out in Athena, returning line 2:12: mismatched input 'AS'. Expecting: ',', 'EXCEPT', 'FETCH', 'FROM', 'GROUP', 'HAVING', 'INTERSECT', 'LIMIT', 'OFFSET', 'ORDER', 'UNION', 'WHERE', 'WINDOW', <EOF>.

Is this an issue for sqlformat?

slashformotion commented 12 hours ago

all formating is handled by the crate sql-format, I would suggest opening the issue there