Skip to content

Fix query builder expressions#22

Open
circulon wants to merge 4 commits into
masonitedev:3.xfrom
circulon:fix/case_insensitivity_in_expresssions
Open

Fix query builder expressions#22
circulon wants to merge 4 commits into
masonitedev:3.xfrom
circulon:fix/case_insensitivity_in_expresssions

Conversation

@circulon

@circulon circulon commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

This PR addresses several issues:

  • case-sensitivity in expression builder classes (alias construction and order direction identifiers)
  • query construction in the QueryBuilder when using table/column aliases

example:

builder = QueryBuilder().table("auth_user AS au").select("email")
print(builder.to_sql())
>>> SELECT "auth_user AS au"."email" FROM "auth_user AS au"

Issues addressed

  • Fixed in expression builder classes
    • FromTable not handling "as " at all producing invalid syntax.
    • the "AS" keyword had to be lowercase or it was not recognised and split correctly
    • the "ASC" and "DESC" keywords had to be lowercase or it was not recognised correctly
    • removed redundant alias parameter from AggregateExpression as its now handled correctly by the column helper
  • Fixed in QueryBuilder
    • added raw parameter to from_ to align with the table method
    • added a deprecation warning to aggragate() about not using the alias parameter
  • General
    • removed redundant process_table() from MySqlGrammar
    • alias identifiers are now not quoted as this is the accepted standard in sql syntax
      • if an alias is a keyword or contains special chars then raw=True can be used
    • renamed postgres grammar test files to align with naming of other dialects files
    • added tests

circulon added 4 commits June 28, 2026 09:30
- Added a helper to make splitting “as alias” clauses simple
- fixed FromExpression not handing alias properly
- removed redundant alias parameter from  AggregateExpression and added a deprecation warning
- added raw param to from_ method
- removed redundant process_table() method from MySqlGrammar
fixed and added tests using alias and order by
renamed postgres grammar test files to match other grammars
@circulon circulon changed the title Fix case insensitivity in expressions Fix case sensitivity in expressions Jun 28, 2026
@circulon circulon changed the title Fix case sensitivity in expressions Fix query builder expressions Jul 9, 2026
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.

1 participant