google / google/google-sql-syntax-ts
Formatting of CTEs
- 主要言語
- TypeScript
- スター
- 10
- フォーク
- 4
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Hello,
We use Dataform and BigQuery extensively in our projects. The built-in SQL formatter, which appears to be based on this repository, presents significant challenges in its current form due to how it handles Common Table Expressions (CTEs).
The primary issue is the lack of clear indentation, making it difficult to discern where CTEs begin and end in the formatted SQL. Below are examples that illustrate this problem:
### Example 1: BigQuery/Dataform Formatter
*The image shows a query formatted by the current formatter. Notice the minimal indentation, making it hard to distinguish the boundaries of the CTEs.*

### Example 2: SQLfluff Formatter
*The same query formatted with SQLfluff. The CTEs are clearly indented, making it easy to identify where they start and end.*

### Example 3: JetBrains Default Formatter (PyCharm/DataGrip)
*Another example using JetBrains' default formatter. It also clearly shows the structure of CTEs through proper indentation.*

### Suggestion
To enhance readability and usability, we suggest the following improvements for CTE formatting:
- **Indentation:** Clearly indent each level of CTEs.
- **Line Breaks:** Ensure that each CTE and its constituent SQL statements are well-separated by line breaks.
Implementing these changes would significantly improve the readability of formatted SQL queries, making it easier for developers to work with complex queries involving multiple CTEs.
Thank you for considering this suggestion.
Best regards,
Schnurres
コントリビューションガイド
評価
この issue はまだ評価されていません。