| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Signed-off-by: Joseph Finlayson <joseph.finlayson@gmail.com>
Signed-off-by: Joseph Finlayson <joseph.finlayson@gmail.com>
Signed-off-by: Joseph Finlayson <joseph.finlayson@gmail.com>
| Back | FazBrowse Home | New Git URL |
Description
SQLMesh can already route a model's execution and gateway-managed virtual layer through its effective gateway. However, the gateway connection's default catalog also qualifies the model, so it determines both the physical snapshot catalog and, normally, the published-view catalog. environment_catalog_mapping can move published views, but it applies one environment-wide catalog override. A shared environment therefore cannot preserve separate physical catalogs while publishing each gateway's models into a different stable catalog.
This adds an optional virtual_layer_catalog to GatewayConfig:
With this configuration, versioned snapshot tables remain in project_a_physical, while stable environment views are published in project_a_published. The route is configured once per gateway rather than repeated on individual models.
Resolution and precedence
State and lifecycle behavior
The resolved route is stored with model and snapshot metadata, including SnapshotTableInfo. This lets a partial multi-project plan preserve the published locations of remote snapshots loaded from shared state even when their project configuration is not loaded.
Changing only virtual_layer_catalog is a metadata-only change. Applying that plan publishes the existing snapshot through the new catalog and demotes the previous view without rebuilding the physical table. Janitor cleanup also uses the persisted route.
Composed project configurations must agree when they define the same gateway name. Conflicting virtual_layer_catalog values raise a configuration error instead of making route resolution depend on project load order.
Compatibility
Prior art and design choice
This builds on SQLMesh's model-level multi-engine routing (#3394), gateway-specific model defaults (#3888), gateway-managed virtual layers (#4101), and environment catalog naming (#4742).
It deliberately avoids a per-model catalog override. #3645 raised the same API-proliferation concern for physical schema routing; a gateway-level policy keeps routing centralized while explicit model gateways continue to provide the existing model-level escape hatch. #4684 tracks the broader, separate problem of generic physical catalog/schema mapping.
dbt provides related but not identical precedents: hierarchical project/directory relation configuration, logical catalog mappings in catalogs.yml, and stable latest-version pointers. This change keeps SQLMesh's existing snapshot and environment semantics while applying the same separation of physical storage from a stable published name.
Test plan
Checklist