Skip to content

Dropdb

snoop.data.management.commands.dropdb #

Delete database from postgres, making sure to drop connections.

This command is required because postgres 12 does not have dropdb --force. It was added in version 13, which we do not have yet.

Classes#

Command #

Retry running task

Methods#
add_arguments(self, parser) #

Entry point for subclassed commands to add custom arguments.

Source code in snoop/data/management/commands/dropdb.py
def add_arguments(self, parser):
    parser.add_argument('db_name', help="databasee name")
handle(self, db_name, **options) #

Find and delete databases, indexes and blobs not bound to any collection.

Source code in snoop/data/management/commands/dropdb.py
def handle(self, db_name, **options):
    """Find and delete databases, indexes and blobs not bound to any collection.
    """
    logging_for_management_command(options['verbosity'])

    collections.drop_db(db_name)