raena_analytics_scripts/OOS/sample.sh

23 lines
845 B
Bash
Raw Normal View History

2024-06-24 12:26:08 +00:00
#!/bin/bash
echo "
--------------------------Revenue Leakage -------------------------
drop table public.om_dormant_sellers_filter;
create table public.om_dormant_sellers_filter
as
select reseller_email,'' as brand_name,'' as sku,Dornant_flag
from public.om_dormant_sellers_filter_base_1
where reseller_email notnull and reseller_email!=''
union
select reseller_email,brand_name,'' as sku,month_cohort
from public.OM_Reseller_brand_month_filter
where reseller_email notnull and reseller_email!='';
" > /home/ec2-user/cronjob/OOS/sample.sql
psql "host=raen-prd-sg-redshift-cluster.cdqj58hfx4p7.ap-southeast-1.redshift.amazonaws.com user=dbadmin dbname=analytics port=5439 password=5qCif6eyY3Kmg4z" -f/home/ec2-user/cronjob/OOS/sample.sql > sample.log