Skip to content

Feature Request: Support Pipe Syntax Formatting on DBx and BigQuery #885

Open

Description

@purvilmehta06

Describe the Feature
Support formatting pipe syntax for Dabaricks and BigQuery.

In this syntax, SQL queries are expressed in a functional style using the pipe operator (|>), allowing operations like SELECT, WHERE, and GROUP BY to be chained together in a readable and modular way. Pipe syntax improves the clarity and structure of SQL by allowing queries to be written as a sequence of transformations, where each step builds on the previous one. This functional style enhances readability, especially for complex queries, by breaking them into logically organized components. It also promotes modular and maintainable code, making it easier to reason about and modify individual parts of a query. As a result, pipe syntax is becoming increasingly popular in modern data workflows and tools that emphasize composability and developer ergonomics.

Why do you want this feature?
Pipe syntax is increasingly being adopted for its readability and composability, especially in data platforms like BigQuery and Databricks. However, most SQL formatters, including this one, do not currently support it. Adding support for pipe syntax would help teams using modern SQL styles to maintain clean, readable, and consistently formatted code without needing to fall back to manual formatting or workarounds. This would be especially valuable in environments that prioritize functional or declarative query composition.

Activity

  1. nene commented on Aug 15, 2025

    @nene
    Collaborator

    Thanks for the feature request. So basically this comes down to being able to write the following SQL:

    SELECT item, COUNT(*) AS num_items, SUM(sales) AS total_sales
    FROM Produce
    WHERE
      item != 'bananas'
      AND category IN ('fruit', 'nut')
    GROUP BY item
    ORDER BY item DESC;

    as:

    FROM Produce
    |> WHERE
        item != 'bananas'
        AND category IN ('fruit', 'nut')
    |> AGGREGATE COUNT(*) AS num_items, SUM(sales) AS total_sales
       GROUP BY item
    |> ORDER BY item DESC;

    It's definitely a major thing to consider. Though it's also a major departure from standard SQL syntax and a major feature to implement.

    There's more of a chance that I'll implement support for it in sql-parser-cst and the related prettier plugin. But implementing it in SQL formatter is less likely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions