Skip to main content

make temp postgres database

Project description


$ [sudo] pip install postgres-mktempdb

Scripts usage

command usage
mktempdb usage: mktempdb [OPTION]...


$ 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 2019.5.23
Filename, size File type Python version Upload date Hashes
Filename, size postgres-mktempdb-2019.5.23.tar.gz (1.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page