Skip to content

Instantly share code, notes, and snippets.

@tiagofrancafernandes
Last active February 9, 2022 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tiagofrancafernandes/c9fa39d91e888e53353c03f33e52335b to your computer and use it in GitHub Desktop.
Save tiagofrancafernandes/c9fa39d91e888e53353c03f33e52335b to your computer and use it in GitHub Desktop.
SQL Snippets
# Exportar
TABLE_NAME="TABELA_ORIGEM"; PGPASSWORD="usuario2016" pg_dump \
-h HOST_ORIGIEM \
-p 5432 \
-U usuario \
--table="$TABLE_NAME" \
usuario > "db-banco-origem-$TABLE_NAME.sql" && notify-send "Finalizado!"
#Importar
DB_NAME="BANCO_DESTINO"; TABLE_NAME="partner_sales"; PGPASSWORD="senha" psql \
-U usuario \
-h host-destino \
-p 5432 \
-d "$DB_NAME" < "db-banco-origem-$TABLE_NAME.sql" && notify-send "Finalizado!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment