feat: add cron_tz to model_defaults by lafirm · Pull Request #5662 · SQLMesh/sqlmesh

Should fix #5661

Summary

Adds support for cron_tz in model_defaults, allowing users to set a default timezone for cron schedules at the project level and gateway level.

Changes

  • Added cron_tz field to ModelDefaultsConfig with proper validation
  • Updated documentation to include cron_tz in the list of supported model_defaults options
  • Added tests for both project-level and gateway-specific cron_tz defaults

Benefits

  • DRY: No need to specify cron_tz on every model when using a standard timezone
  • Gateway flexibility: Different environments can use different default timezones
  • Consistency: Uses the same validation logic as model-level cron_tz
  • Backward compatible: Existing configs without cron_tz continue to work (defaults to UTC)

Example Usage

# Project-level default
model_defaults:
  dialect: snowflake
  cron: '@daily'
  cron_tz: 'America/Los_Angeles'

# Gateway-specific override
gateways:
  production:
    connection:
      type: snowflake
    model_defaults:
      cron_tz: 'America/New_York'