You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works fine except when loading the ui which results in this kind of error:
Reference 'RANGE_START(valid_date_range)' must have an inferrable name or explicit alias.
Traceback (most recent call last):
File ".venv/lib/python3.11/site-packages/web/server/settings.py", line 102, in get_loaded_context
yield _get_loaded_context(settings.project_path, settings.config, settings.gateway)
sqlmesh.utils.errors.ConfigError: Reference 'RANGE_START(valid_date_range)' must have an inferrable name or explicit alias.
We do not see errors anywhere else when using RANGE_START(...) in the grain definition, only in the UI.
The text was updated successfully, but these errors were encountered:
Would it work to specify an alias in this case? E.g., this model doesn't have the issue @plaflamme mentioned:
MODEL(
name foo,
grain (id, RANGE_START(valid_date_range) AS valid_date_range_start)
);
WITH t AS (
SELECT'1'AS id,
DATE('2025-05-06') AS valid_from,
DATE('2020-05-07') AS valid_to
)
SELECT
id::STRING AS id,
RANGE(valid_from, valid_to)::RANGE<DATE>AS valid_date_range
FROM t
I think expecting a valid output name and not an arbitrary expression may be intentional in this case, because as Toby said grains are, e.g., used in table diff where you want to reference it by name. Otherwise how would you specify the expression grain shown here?
We have a table that uses BigQuery's
RANGE
type like so:This works fine except when loading the
ui
which results in this kind of error:We do not see errors anywhere else when using
RANGE_START(...)
in thegrain
definition, only in the UI.The text was updated successfully, but these errors were encountered: