◐ Shell
clean mode source ↗

fix: Add alias_tokens parameter to _parse_join() for sqlglot 30.9.0 compactibilty by iawanish · Pull Request #5847 · SQLMesh/sqlmesh

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