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
{{ message }}
Repository navigation
Using kind INCREMENTAL_BY_TIME_RANGE and running sqlmesh plan give 'ConfigError: Time column '' not found in model', snowflake normalisation= case_insensitive #5710
When using INCREMENTAL_BY_TIME_RANGE models with a Snowflake connection and normalization_strategy=case_insensitive in the dialect, sqlmesh plan fails with:
ConfigError: Time column '' not found in model 'my_schema.my_model'
Root Cause
In sqlmesh/core/model/definition.py, the convert_to_time_column method (line ~831) does a case-sensitive Python dict lookup:
MODEL (
name my_schema.my_model,
kind INCREMENTAL_BY_TIME_RANGE (
time_column CreatedAtUtc
)
);
SELECTsrc.CreatedAtUtc,
src.IdFROMupstream.sourceAS src
WHEREsrc.CreatedAtUtc BETWEEN @start_date AND @end_date
Run sqlmesh --gateway snowflake_prod plan → fails with Time column '' not found.
Suggested Fix
Normalize the column names from engine_adapter.columns() before comparison, or make the lookup in convert_to_time_column case-insensitive:
A more robust fix might normalize column names at the point they're returned from engine_adapter.columns() (line ~501) to match the model's normalization strategy.
SELECT
us.StartedAtUtc AS CreatedAtUtc,
us.UserSessionId,
us.UserId,
us.OrganisationId,
us.Device_Brand,
us.Device_Family,
us.Device_Model,
COALESCE(SmartEnum_FormFactor.[Name], 'Unknown') AS Device_FormFactor,
us.OS_Family,
us.OS_Major,
us.OS_Minor,
us.Browser_Family,
us.Browser_Major,
us.Browser_Minor,
us.Location_City AS IpLocation_City,
us.Location_CountryCode AS IpLocation_CountryCode,
us.Location_Latitude AS IpLocation_Latitude,
us.Location_Longitude AS IpLocation_Longitude
FROM orgs.UserSessions AS us
WHERE
us.StartedAtUtc BETWEEN @start_dt AND @end_dt
LEFT JOIN [orgs].[SmartEnum_FormFactor] AS SmartEnum_FormFactor
ON us.Device_FormFactor = SmartEnum_FormFactor.Id`
changed the title [-]Using kind INCREMENTAL_BY_TIME_RANGE and running sqlmesh plan give 'ConfigError: Time column '' not found in model'[/-][+]Using kind INCREMENTAL_BY_TIME_RANGE and running sqlmesh plan give 'ConfigError: Time column '' not found in model', snowflake normalisation= case_insensitive[/+]on Feb 25, 2026
Activity
SophieLee-Hoareau commentedon Feb 25, 2026
model example (project dialects is t-sql, normalisation=case_insensitive)
`MODEL (
name analytics_usersessions.usersession_details,
kind INCREMENTAL_BY_TIME_RANGE (
time_column CreatedAtUtc
),
tags 'usersessions',
grain UserSessionId,
cron '@daily',
audits (
NUMBER_OF_ROWS(threshold := 1),
UNIQUE_VALUES(columns := (
UserSessionId
)),
NOT_NULL(columns := (
UserSessionId
))
)
);
SELECT
us.StartedAtUtc AS CreatedAtUtc,
us.UserSessionId,
us.UserId,
us.OrganisationId,
us.Device_Brand,
us.Device_Family,
us.Device_Model,
COALESCE(SmartEnum_FormFactor.[Name], 'Unknown') AS Device_FormFactor,
us.OS_Family,
us.OS_Major,
us.OS_Minor,
us.Browser_Family,
us.Browser_Major,
us.Browser_Minor,
us.Location_City AS IpLocation_City,
us.Location_CountryCode AS IpLocation_CountryCode,
us.Location_Latitude AS IpLocation_Latitude,
us.Location_Longitude AS IpLocation_Longitude
FROM orgs.UserSessions AS us
WHERE
us.StartedAtUtc BETWEEN @start_dt AND @end_dt
LEFT JOIN [orgs].[SmartEnum_FormFactor] AS SmartEnum_FormFactor
ON us.Device_FormFactor = SmartEnum_FormFactor.Id`
[-]Using kind INCREMENTAL_BY_TIME_RANGE and running sqlmesh plan give 'ConfigError: Time column '' not found in model'[/-][+]Using kind INCREMENTAL_BY_TIME_RANGE and running sqlmesh plan give 'ConfigError: Time column '' not found in model', snowflake normalisation= case_insensitive[/+]