Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

make temp postgres database

Project description


$ [sudo] pip install postgres-mktempdb
$ [sudo] npm i -g postgres-mktempdb


$ mktempdb

delete temp databases:

$ psql -At -c "SELECT datname FROM pg_database WHERE datname LIKE 'tmp_%'" | xargs -L 1 dropdb

delete temp databases created more than 5 minutes ago:

$ psql -At -c "SELECT datname FROM pg_database
WHERE datname LIKE 'tmp_%' AND (pg_stat_file('base/'||oid||'/PG_VERSION')).modification<now()+interval '5 minutes'" | xargs -L 1 dropdb

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for postgres-mktempdb, version 2020.7.1
Filename, size File type Python version Upload date Hashes
Filename, size postgres-mktempdb-2020.7.1.tar.gz (1.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page