Below is the manual code for pushing data to the Prod dashboard. This process has been automated now for MTSA Pro, Pro+ and Enterprise via the SA/TVA Ops Overview board and for Source Reports on the backend. For details on the automated processes, see Push to Prod for Ops Team.
The manual processes below should only be used in exceptional cases.
--INSERTING (FLAGGING) PROPERTIES TO PROD--
Insert into sales.production_ready (property_id, sales_month) VALUES ('${PROPID}', '${SALESMONTH YYYY-MM-01}')
ON CONFLICT (property_id, sales_month) DO UPDATE SET created_ts = now();
-- after all properties are inserted, go to Airflow and run daily_sa_refresh_prod_dashboard --
-- then check #salesattribution channel in Slack for SA_Refresh_Dashboard / status: PASS --
--VIEWING PRODUCTION READY TABLE BY PROPERTY--
SELECT * FROM sales.production_ready WHERE property_id in (${PROPIDS Sep by Commas})
ORDER BY to_date(sales_month :: TEXT, 'YYYY-MM-DD') DESC;
--VIEWING PRODUCTION READY TABLE FOR A MONTH--
SELECT * FROM sales.production_ready WHERE sales_month = '${SALESMONTH}'
ORDER BY to_date(sales_month :: TEXT, 'YYYY-MM-DD') DESC;
--DELETING FROM PRODUCTION READY--
delete from sales.production_ready WHERE property_id in (${PROPIDS Sep by Commas})
AND sales_month = '${SALESMONTH}';
--UPDATE TIMESTAMP TO FORCE CLICKTRAILS EXCEL FILE REFRESH--
update sales.production_ready set created_ts = now()
WHERE property_id = ${PROPID}
AND sales_month = '${SALESMONTH}';
-- Find Source Reports properties that have been pushed to PROD for a specific month --
SELECT * FROM sales.production_ready
JOIN clarivoy.mongodb.prod_properties_ft ON production_ready.property_id = prod_properties_ft.property_id
where 'source_rpts' = any(prod_properties_ft.products)
and production_ready.sales_month = '${SALESMONTH}'
ORDER BY to_date(sales_month :: TEXT, 'YYYY-MM-DD') DESC;
-- Find properties pushed to PROD for a specific month during a specific timeframe (created_ts)
SELECT * FROM sales.production_ready WHERE
created_ts >= '${CREATED_TS_GT_OR_EQUAL}'
and sales_month != '${SALESMONTH}';