Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago - last edited a week ago
The best I could come up if after some back and forth with Claude is this:
DECLARE target_fqn STRING;
DECLARE source_fqn STRING;
DECLARE q STRING;
DECLARE sql_stmt STRING;
SET VAR target_fqn = :target_fqn;
SET VAR source_fqn = :source_fqn;
SET VAR q = char(39);
SET VAR sql_stmt = CONCAT(
'CREATE MATERIALIZED VIEW IF NOT EXISTS ', target_fqn,
' TBLPROPERTIES (', q, 'delta.columnMapping.mode', q, ' = ', q, 'name', q, ')',
' TRIGGER ON UPDATE',
' AS',
' select',
' cast(abc as TIMESTAMP) as `A B C`,',
' cast(xyz as TIMESTAMP) as `X Y Z`,',
' from ', source_fqn
);
EXECUTE IMMEDIATE sql_stmt
There must be a better way in Databricks?🤔