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
Commit 0d8f7b0
Browse filesBrowse the repository at this point in the historyBrowse files
fix(redshift): prevent empty-schema CREATE TABLE when late-binding CTAS view metadata is unavailable
Unannotated SCD_TYPE_2_BY_TIME and SCD_TYPE_2_BY_COLUMN models on Redshift create their snapshot table via empty CTAS (WHERE FALSE LIMIT 0) through VarcharSizeWorkaroundMixin. When svv_columns returned 0 rows for the temporary late-binding view (e.g. over Redshift Datashares, cross-database relations, or restricted search_path schemas), RedshiftEngineAdapter.columns() returned {}, causing VarcharSizeWorkaroundMixin to emit a truncated column-less CREATE TABLE statement (SQLSTATE 42601: syntax error at end of input).
- Fall back in RedshiftEngineAdapter.columns() from svv_columns to pg_get_late_binding_view_cols() and pg_catalog.pg_attribute without aborting active transactions, and respect explicit no_schema_binding in create_view().
- Guard VarcharSizeWorkaroundMixin._build_create_table_exp() so empty or unknown view column metadata falls back to the CTAS query instead of building an empty schema.
- Return False from columns_to_types_all_known({}) so create_table() raises SQLMeshError rather than emitting column-less DDL.
- Quote unmanaged column identifiers in EngineAdapter._scd_type_2() so reserved keywords and special-character column names render safely.
Fixes#5787
Signed-off-by: Vamsi-klu <nrvamsi13@gmail.com>
0 commit comments