replace pg topups with struct from flat table

PHOTO EMBED

Fri Jul 29 2022 07:28:53 GMT+0000 (Coordinated Universal Time)

Saved by @alvaroferrer #sql

create or replace table `reby-cloud.analytics_reby_v1_eu.pg_topups_json`
as

select
  id,
  created_at,
  gateway,
  gateway_transaction_id,
  stripe_charge_id,
  array(select as struct value_amount as amount, value_currency as currency) as value,
  array(select as struct original_value_amount as amount, original_value_currency as currency) as original_value,
  user_id,
  company_id,
  braintree_transaction_id
from `reby-cloud.staging_eu.pg_topups_stg`
content_copyCOPY