Skip to content

Commit eb2a6e8

Browse files
committed
cleanup
1 parent b19106f commit eb2a6e8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

process_csv.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function get_lines_except_last_two {
1717

1818
for f in $(ls raw_billing_csvs)
1919
do
20-
echo doing $f
20+
echo doing $f
2121
CSV_FILENAME='current.csv'
2222
cp raw_billing_csvs/${f} "${CSV_FILENAME}"
2323

@@ -66,6 +66,10 @@ do
6666
echo "\\COPY tmp_cost (project_id,service_id,sku_id,credit_type,cost_type,usage_start_date,usage_end_date,usage_amount,usage_unit,unrounded_cost,cost,invoice_date) FROM 'cost.csv' DELIMITER ',' CSV HEADER" | psql cost
6767
echo 'insert into cost (credit_type, cost_type, usage_start_date, usage_end_date, usage_amount, usage_unit, project_id, service_id, sku_id, unrounded_cost, cost, invoice_date) select credit_type, cost_type, usage_start_date, usage_end_date, usage_amount, usage_unit, project_id, service_id, sku_id, unrounded_cost, cost, invoice_date from tmp_cost on conflict do nothing' | psql cost
6868

69+
echo 'drop table if exists tmp_cost' | psql -t cost
70+
echo 'drop table if exists tmp_sku' | psql -t cost
71+
echo 'drop table if exists tmp_service' | psql -t cost
72+
echo 'drop table if exists tmp_project' | psql -t cost
6973
# Clean up
70-
#rm -f "${CSV_FILENAME}" "$tmpfile1" "$tmpfile2" project.csv service.csv sku.csv "${tmpfile_header}"
74+
rm -f "${CSV_FILENAME}" "$tmpfile1" "$tmpfile2" project.csv service.csv sku.csv "${tmpfile_header}"
7175
done

0 commit comments

Comments
 (0)