Skip to content

Improve SQL formatting and query generation consistency#33

Merged
jeffreyaven merged 1 commit intomainfrom
claude/format-stackql-exists-clauses-cM158
Feb 23, 2026
Merged

Improve SQL formatting and query generation consistency#33
jeffreyaven merged 1 commit intomainfrom
claude/format-stackql-exists-clauses-cM158

Conversation

@jeffreyaven
Copy link
Contributor

Description

This PR improves the formatting and consistency of generated SQL code examples and queries throughout the documentation generation and deployment dropdown components.

Key Changes

SQL Formatting Improvements:

  • Standardized indentation in DELETE, UPDATE, and INSERT statements to use consistent 2-space indentation
  • Reformatted WHERE clauses to be on separate lines with proper indentation for better readability
  • Updated the getColumns() function to consistently indent column lists with 2 spaces

Query Generation Fixes:

  • Fixed buildExistsQuery() to properly format multi-line WHERE clauses with AND conditions on separate lines
  • Enhanced buildStatecheckQuery() to:
    • Avoid duplicate conditions by filtering out fields already present in the WHERE clause (e.g., region)
    • Properly format all conditions with consistent line breaks
  • Updated buildTemplate() exports query to:
    • Use all GET fields minus region (instead of only mutable fields)
    • Apply consistent multi-line WHERE clause formatting
    • Fix trailing semicolon placement

Template Extraction:

  • Changed the fallback section for INSERT examples from 'Required Properties' to 'All Properties' to match the actual generated documentation structure

Motivation

These changes ensure that:

  1. Generated SQL examples follow consistent formatting conventions
  2. Query builders produce properly formatted, readable SQL with correct indentation
  3. WHERE clauses with multiple conditions are formatted on separate lines for clarity
  4. Duplicate conditions are avoided in state check queries
  5. The template extraction correctly identifies the appropriate section for INSERT examples

Checklist

  • The PR title is descriptive
  • Changes improve code consistency and SQL readability

Additional Notes

All changes are focused on formatting and query generation logic. The functional behavior of the generated SQL remains the same, but the output is now more consistent and readable.

https://claude.ai/code/session_01LywYKJZwGUrrstHH89SgCS

- exists: split WHERE clause conditions onto separate lines
- create: use All Properties tab instead of Required Properties
- statecheck: remove duplicate region conditions, format WHERE on new lines
- exports: use all GET fields (minus region), format WHERE on new lines
- generate-docs: add 2-space indentation to SELECT columns, INSERT
  columns/values, and WHERE conditions; format DELETE/UPDATE WHERE clauses

https://claude.ai/code/session_01LywYKJZwGUrrstHH89SgCS
@jeffreyaven jeffreyaven merged commit 5b48ffa into main Feb 23, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants