This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DECLARE START_DATETIME timestamp DEFAULT '2020-12-31 15:00:00'; | |
| DECLARE END_DATETIME timestamp DEFAULT '2021-01-31 15:00:00'; | |
| CREATE TABLE user_ippei.202101_source_account OPTIONS( | |
| expiration_timestamp=TIMESTAMP_ADD(CURRENT_TIMESTAMP(), INTERVAL 2 DAY) | |
| ) as ( | |
| select | |
| case when w.type = 'MERCHANT' then w.user_id else '' end as merchant_id, | |
| case when a.type = 'SYSTEM_EXPIRED' then 'SYSTEM_EXPIRED' else JSON_EXTRACT_SCALAR(a.metadata, '$.campaign_token') end as campaign_token, | |
| case when a.type = 'SYSTEM_EXPIRED' then a.type else w.type end as campaign_type |