Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom timezones for model cron expressions #3972

Open
izeigerman opened this issue Mar 11, 2025 · 0 comments
Open

Support custom timezones for model cron expressions #3972

izeigerman opened this issue Mar 11, 2025 · 0 comments
Assignees
Labels
Feature Adds new functionality

Comments

@izeigerman
Copy link
Member

izeigerman commented Mar 11, 2025

Currently, when specifying a cron expression in a model, it is always applied in the UTC timezone. However, sometimes it is important to run models at a specific time in a specific timezone.

This proposal suggests introducing a new attribute to the model definition (e.g., cron_tz), which specifies the timezone SQLMesh should use when computing the next timestamp for the model's execution.

Please note, that supporting custom timezones for data intervals and start_* / end_* macros is out of scope of this proposal. The impact of this is strictly limited to the cron expression.

Model definition example:

MODEL (
    name test_schema.test_model,
    cron '0 1 * * *',
    cron_tz ' EST',
);

When computing the next execution timestamp, SQLMesh should first apply the custom timezone to the input timestamp serving as the basis for the calculation, determine the next timestamp, and then convert the result back to UTC before returning it for further processing.

The new cron_tz attribute should also be available as part of the model defaults configuration.

@izeigerman izeigerman added the Feature Adds new functionality label Mar 11, 2025
@tobymao tobymao self-assigned this Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Adds new functionality
Projects
None yet
Development

No branches or pull requests

2 participants