Skip to content

Instantly share code, notes, and snippets.

View davidahopp's full-sized avatar

David Hopp davidahopp

View GitHub Profile
@davidahopp
davidahopp / psql_to_csv.sh
Last active August 28, 2023 19:14 — forked from sharmaeklavya2/psql_to_csv.sh
Export all tables including headers in a postgres database to a set of CSV files
#!/bin/bash
DB_NAME="$USER"
DBMS_SHELL="psql"
DBMS_USER="postgres"
#if [ "$1" = '--help' ]; then
if [[ ( "$1" == '--help' ) || ( "$1" == '-h' ) ]]; then
echo "usage: $0 [DB_NAME] [DBMS_SHELL]"
echo "default DB_NAME is your username"