Skip to content

Instantly share code, notes, and snippets.

@aravinthanpnk
Created October 21, 2024 04:30
Show Gist options
  • Select an option

  • Save aravinthanpnk/b03e144173c7216177277d7761810b25 to your computer and use it in GitHub Desktop.

Select an option

Save aravinthanpnk/b03e144173c7216177277d7761810b25 to your computer and use it in GitHub Desktop.
Python - Commands
Connect to the database via CLI:
psql "user=username host=hostname dbname=databasename"
--> it will ask passsword
To backup by schema:
pg_dump -U user -d databasse -h host -n schema -F c -f file_name.tar.gz
To restore:
pg_restore -c -U username -d database -h host -v "full_path_backup_file_location" -W
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment