Skip to content

fix: Add alias_tokens parameter to _parse_join() for sqlglot 30.9.0 compactibilty #5847

Open
iawanish wants to merge 2 commits into
SQLMesh:mainfrom
iawanish:fix/sqlglot-30-9-compatibility-clean
Open

fix: Add alias_tokens parameter to _parse_join() for sqlglot 30.9.0 compactibilty #5847
iawanish wants to merge 2 commits into
SQLMesh:mainfrom
iawanish:fix/sqlglot-30-9-compatibility-clean

Conversation

@iawanish

Copy link
Copy Markdown

Description

Fixes #5840
This PR fixes compatibility with sqlglot 30.9.0 by updating the overridden _parse_join() method in sqlmesh/core/dialect.py to match the upstream parser signature.

Problem

With sqlglot 30.9.0+, SQLMesh raises:

TypeError: _parse_join() got an unexpected keyword argument 'alias_tokens'

This happens because sqlglot introduced the alias_tokens parameter in Parser._parse_join(), while SQLMesh's override was still using the older method signature.

Changes

  • Added the optional alias_tokens parameter to _parse_join().
  • Forwarded alias_tokens to the internal __parse_join() calls.
  • Preserved backward compatibility by making the parameter optional.

This change allows SQLMesh to work correctly with sqlglot 30.9.0+ without affecting existing behavior.

Test Plan

  • Tested with sqlglot==30.9.0.
  • Verified that the previous TypeError no longer occurs.
  • Tested the DB2 adapter using the external DB2 sqlglot dialect.
  • Confirmed that SQL parsing behaves as expected after the change.

Checklist

  • [] I have run make style and fixed any issues
  • I have added tests for my changes (if applicable)
  • All existing tests pass (make fast-test)
  • My commits are signed off (git commit -s) per the DCO

iawanish and others added 2 commits June 18, 2026 12:44
…ompatibility

- Add missing alias_tokens parameter to _parse_join() method signature
- Pass alias_tokens to internal __parse_join() calls
- Maintain backward compatibility with optional parameter
- Fixes TypeError when using sqlglot 30.9.0 or later

Resolves compatibility issue where SQLMesh's _parse_join() override
was incompatible with sqlglot 30.9.0's updated method signature.

Signed-off-by: Awanish Gupta <awanishgupta159@gmail.com>
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.

Upgrade to sqlglot 30.9.0 to support external dialect plugins

1 participant