File: sqlmesh/core/renderer.py
Functions: _resolve_table , _resolve_tables
Lines: 326 - 418
Issue with _resolve_table:
_resolve_table resolves one table but passes the full physical + view mapping into exp.replace_tables, which re-parses every mapping key.
The full mapping today is passed to the exp.replace_tables and is:
{
**self._to_table_mapping((snapshots or {}).values(), deployability_index),
**(table_mapping or {}),
}
Look up this table’s entry (table_mapping overrides physical) and pass a one-entry dict into exp.replace_tables.
Keying must match how replace_tables normalizes names (quoting/case), or we miss. Either normalize this one name the same way before lookup, or pass the one pair through and let replace_tables normalize that single key.
Issue with _resolve_tables:
We pass in expression and create the table_mapping. Problem is, we don't check if the expression contains a table node, which is what's required for any of the downstream code to be useful.
So basically:
if not snapshots and not table_mapping and not expand:
return expression
if not expression.find(exp.Table): <----- NEW
return expression
expression = expression.copy()
This skips the execution entirely for expressions that only contain virtual or session properties.
File:
sqlmesh/core/renderer.pyFunctions:
_resolve_table,_resolve_tablesLines:
326 - 418Issue with
_resolve_table:_resolve_tableresolves one table but passes the full physical + view mapping intoexp.replace_tables, which re-parses every mapping key.The full mapping today is passed to the
exp.replace_tablesand is:Look up this table’s entry (table_mapping overrides physical) and pass a one-entry dict into
exp.replace_tables.Keying must match how replace_tables normalizes names (quoting/case), or we miss. Either normalize this one name the same way before lookup, or pass the one pair through and let replace_tables normalize that single key.
Issue with
_resolve_tables:We pass in
expressionand create the table_mapping. Problem is, we don't check if the expression contains a table node, which is what's required for any of the downstream code to be useful.So basically:
This skips the execution entirely for expressions that only contain virtual or session properties.