#! /bin/bash # Setting Postgis password export PGPASSWORD="postgis_password" for i in $(ls /home/user/Saravaana/Summary_Data_Generation/pyspark/Output_File/COL/05/*.csv); do echo "Started: $i" psql -h host -U user -d database -c "\copy public.transdata (maid, transaction_datetime, latitude, longitude, geohash, dwell_time_in_seconds) from '$i' with (format csv,header true, delimiter ',');" echo "Completed: $i" done; # Unset password after the script finishes for security unset PGPASSWORD
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter