◐ Shell
clean mode source ↗

feat: support CLUSTER BY AUTO and CLUSTER BY NONE for Databricks liquid clustering by EhabEasee · Pull Request #5846 · SQLMesh/sqlmesh

@EhabEasee @claude

…id clustering

Adds parser, validator, and Databricks adapter support for the keyword
forms of liquid clustering. Bare AUTO/NONE (unquoted VAR tokens) are
recognised as keywords; backtick-quoted `auto`/`none` and
parenthesised forms remain real column references.

- Add LIQUID_CLUSTERING_KEYWORDS constant to avoid repeating the
  sentinel set across dialect, meta, definition, and adapter
- Parser (dialect.py): detect VAR-token AUTO/NONE on clustered_by;
  strip Paren from single-column clustered_by to match partitioned_by
  normalisation
- Validator (meta.py): normalise single string input to list; restore
  keyword sentinels from JSON strings on deserialisation; skip
  column-count check for keywords, gated on clustered_by + databricks
- validate_definition (definition.py): skip keyword sentinels in the
  column-existence check, same gate
- Adapter (databricks.py): emit CLUSTER BY AUTO / CLUSTER BY NONE
  without a tuple wrapper; raise ValueError on unexpected bare Var
- Tests: parser round-trips, Python API (exp.Var and plain string),
  backtick-quoted columns, render_definition, JSON round-trip,
  non-Databricks rejection, mixed-list behaviour, adapter SQL emission

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: EhabEasee <ehab.elbadrawi@easee.com>