--- warning: DO NOT CHANGE THIS MANUALLY, THIS IS GENERATED BY https://github.com/duckdb/community-extensions repository, check README there title: timestral excerpt: | DuckDB Community Extensions Zero-shot probabilistic time-series forecasting in SQL with Mistral's Timestral models, on CPU via ONNX Runtime extension: name: timestral description: Zero-shot probabilistic time-series forecasting in SQL with Mistral's Timestral models, on CPU via ONNX Runtime version: '0.1.1' language: C++ build: cmake license: MIT excluded_platforms: "wasm_mvp;wasm_eh;wasm_threads;windows_amd64_mingw;linux_amd64_musl" requires_toolchains: "vcpkg" maintainers: - redox repo: github: altertable-ai/duckdb-timestral ref: 8f0bc7fe5e83d127abd4ea1b4115fa1ab121006b variegata: 7d6486900113e4271f8e32324adf27776b63a02b docs: hello_world: | INSTALL timestral FROM community; LOAD timestral; -- Hourly series, one per store. The 5M model (~21 MB) is downloaded and cached on first use. CREATE TABLE sales AS SELECT g AS store, TIMESTAMP '2026-01-01' + INTERVAL (i) HOUR AS ts, 10 * g + sin(i / 6) AS amount FROM range(3) a(g), range(500) b(i); -- Forecast the next 24 hours of every store: median plus 21 quantiles per step. SELECT store, ts, forecast, q10, q90 FROM sales TIMESTRAL_FORECAST (amount PARTITION BY store ORDER BY ts HORIZON 24); -- The same with the aggregate, for full control over grouping. SELECT store, unnest(timestral_forecast(amount ORDER BY ts HORIZON 24), recursive := true) FROM sales GROUP BY store; extended_description: | **timestral** runs [Mistral's Timestral](https://mistral.ai/news/timestral/) zero-shot forecasting models inside DuckDB. There is no training step, no Python and no GPU: the network runs on CPU through a statically linked ONNX Runtime, and a forecast is one SQL query. - `FROM t TIMESTRAL_FORECAST (value PARTITION BY ... ORDER BY time HORIZON n [EVERY step] [USING MODEL size] [WITH HISTORY])` returns one row per series and future step: the time, `forecast` (the median) and the 21 quantiles `q01` to `q99`. The time can be TIMESTAMP, TIMESTAMPTZ, DATE or an integer step. Missing values (NULL) and gaps are handled; the step is inferred, or passed as `EVERY INTERVAL '1 month'`. - `timestral_forecast(value ORDER BY time HORIZON n ...)` is the aggregate behind it, one list per group. - `timestral_models()` lists the four model sizes (5M default, 28M, 123M, 209M) and whether they are cached. Set `timestral_model_path` to use a local file offline. The forecasts match Mistral's reference PyTorch implementation to within 1e-6 of the series scale. **Licence of the model weights.** The extension is MIT licensed. The Timestral weights it downloads are Mistral AI's, under Mistral's Modified MIT licence, which **grants no rights to companies whose consolidated monthly revenue exceeds $20 million**. Read the licence before using the models, and contact Mistral AI for a commercial licence if it applies to you. extension_star_count: 9 extension_star_count_pretty: 9 extension_download_count: 513 extension_download_count_pretty: 513 image: '/images/community_extensions/social_preview/preview_community_extension_timestral.png' layout: community_extension_doc --- ### Compatibility Matrix This table covers all DuckDB releases that have not reached [end-of-life](https://duckdb.org/release_calendar), including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 | | :--- | :---: | :---: | :---: | :---: | :---: | | Linux AMD64 | ❌ | ❌ | ❌ | ❌ | ✅ | | Linux ARM64 | ❌ | ❌ | ❌ | ❌ | ✅ | | macOS AMD64 | ❌ | ❌ | ❌ | ❌ | ✅ | | macOS ARM64 | ❌ | ❌ | ❌ | ❌ | ✅ | | Windows AMD64 | ❌ | ❌ | ❌ | ❌ | ✅ | | Windows ARM64 | ❌ | ❌ | ❌ | ❌ | ❌ | | WebAssembly | ❌ | ❌ | ❌ | ❌ | ❌ | ### Installing and Loading ```sql INSTALL {{ page.extension.name }} FROM community; LOAD {{ page.extension.name }}; ``` {% if page.docs.hello_world %} ### Example ```sql {{ page.docs.hello_world }}``` {% endif %} {% if page.docs.extended_description %} ### About {{ page.extension.name }} {{ page.docs.extended_description }} {% endif %} ### Added Functions
| function_name | function_type | description | comment | examples | |--------------------|---------------|-------------|---------|----------| | timestral_forecast | aggregate | NULL | NULL | | | timestral_models | table | NULL | NULL | | | timestral_version | scalar | NULL | NULL | | ### Overloaded Functions
This extension does not add any function overloads. ### Added Types
This extension does not add any types. ### Added Settings
| name | description | input_type | scope | aliases | typed_value | |---------------------------|------------------------------------------------------------------------------------|------------|--------|---------|-------------------------------------------| | active_grammar_extensions | The grammar extensions used by the parser. | VARCHAR[] | LOCAL | [] | [shell, timestral] | | temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp | | timestral_cache_dir | Directory downloaded Timestral models are cached in | VARCHAR | GLOBAL | [] | ~/.duckdb/timestral/v2 | | timestral_model | Default Timestral model size: 5m, 28m, 123m or 209m | VARCHAR | GLOBAL | [] | 5m | | timestral_model_path | Explicit local .onnx file to use instead of the download cache (no checksum check) | VARCHAR | GLOBAL | [] | | | timestral_model_url | Base URL the Timestral .onnx files are downloaded from | VARCHAR | GLOBAL | [] | https://assets.altertable.ai/timestral/v2 |