Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dataform format: if-based columns are indented at the same level as the "select" clause #1864

Open
kevin-zhou-dev opened this issue Oct 25, 2024 · 2 comments

Comments

@kevin-zhou-dev
Copy link

dataform --version returns 3.0.2

Initial sqlx file:

config {
  type: "view",
  schema: "my_schema"
}

SELECT
  id,
  IF( duration >= 120, TRUE, FALSE ) AS flag_a
FROM
  TABLE

After executing dataform format:

config {
  type: "view",
  schema: "my_schema"
}

SELECT
  id,
IF
  ( duration >= 120, TRUE, FALSE ) AS flag_a
FROM
  TABLE

Expected:

config {
  type: "view",
  schema: "my_schema"
}

SELECT
  id,
  IF( duration >= 120, TRUE, FALSE ) AS flag_a
FROM
  TABLE
@kevin-zhou-dev kevin-zhou-dev changed the title dataform format: if-based columns are indented in the same level as the "select" clause dataform format: if-based columns are indented at the same level as the "select" clause Oct 25, 2024
@mrmeszaros
Copy link

Reproduced on my machine with dataform v3.0.0

@Ekrekr
Copy link
Contributor

Ekrekr commented Dec 13, 2024

Hi Kevin,

Agreed this is weird. This SQL formatting is actually handled by this package: https://github.com/google/google-sql-syntax-ts. It's the open sourced code from BigQuery's internal formatter, and it doesn't conform to a lot of SQL style principles - so I'm interested in replacing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants