Menu

1 / 4

How to Forecast in Databricks SQL with ai_forecast

DEV Community: sql·Nagaraju Bondala·about 18 hours ago
#zGJMIIap
#devtosql#devto#dev#version#forecast
Long article (2170 words) — no AI summary yet.
Reading 0:00
15s threshold

Forecasting usually means exporting data, training a model and writing the results back, so many teams skip it. The ai_forecast function in Databricks SQL does the forecast in one query, and version 2 adds holiday support, covariates and non-negative forecasts on top of a time series foundation model. This guide builds a daily sales forecast step by step: you prepare the input, run a basic forecast, switch to version 2, add holidays, add a covariate and constrain the output to non-negative values. In testing, the biggest gain did not come from the new model, but from telling it about planned promotions. The complete code for this guide is on GitHub: ai-forecast .

Forecast error for five setups, from version 1 to planned promotions, in 30 seconds.

What is ai_forecast in Databricks SQL

ai_forecast is a table-valued function that reads a table of history and returns forecasted values with an upper and a lower bound.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.