Delete a case or individual from the database.

    If no database was found run puzzle init first.
347779
def delete(ctx, family_id, individual_id, root):
    
    root = root or ctx.obj.get('root') or os.path.expanduser("~/.puzzle")

    if os.path.isfile(root):
        logger.error("'root' can't be a file")
        ctx.abort()

    logger.info("Root directory is: {}".format(root))

    db_path = os.path.join(root, 'puzzle_db.sqlite3')
    logger.info("db path is: {}".format(db_path))

    if not os.path.exists(db_path):
        logger.warn("database not initialized, run 'puzzle init'")
        ctx.abort()

    store = SqlStore(db_path)

    if family_id:
        case_obj = store.case(case_id=family_id)
        if case_obj is None:
            logger.warning("Family {0} does not exist in database"
                           .format(family_id))
            ctx.abort()
        store.delete_case(case_obj)
    elif individual_id:
        ind_obj = store.individual(ind_id=individual_id)
        if ind_obj.ind_id != individual_id:
            logger.warning("Individual {0} does not exist in database"
                           .format(individual_id))
            ctx.abort()
        store.delete_individual(ind_obj)
    else:
        logger.warning("Please provide a family or individual id")
        ctx.abort()
107585
@Override
    public void delete(IEntityLock lock) throws LockingException {
        Connection conn = null;
        try {
            conn = RDBMServices.getConnection();
            primDelete(lock, conn);
        } catch (SQLException sqle) {
            throw new LockingException("Problem deleting " + lock, sqle);
        } finally {
            RDBMServices.releaseConnection(conn);
        }
    }
1026548
def delete_database(self, name_or_obj):
        
        name = utils.get_name(name_or_obj)
        self._database_manager.delete(name)
537463
def delete_suspect(self, suspect_id):
        """"""
        suspect_obj = self.suspect(suspect_id)
        logger.debug("Deleting suspect {0}".format(suspect_obj.name))
        self.session.delete(suspect_obj)
        self.save()
1370516
def delete(self):
        

        if not HAS_SQL:  # pragma: nocover
            return
        try:
            conn, c = self.connect()
            c.execute('DELETE FROM {0}'.format(self.table_name))
            conn.commit()
            conn.close()
        except:
            log.traceback(logging.DEBUG)
874699
def delete(self, instance):
        
        
        #TODO: Really drop the database based on a policy set in `instance.parameters`.
        #
        #      We need :
        #      - Set a policy in parameters of the instance (eg: policy-on-delete : retain|drop    => default to retain)
        #      - to check that the database name `instance.get_dbname()` is not in use by another instance (shared database)
        #      - credential on the Atlas cluster `instance.get_cluster()` to drop the database
        #
        
        self.backend.storage.remove(instance)
        
        return DeprovisionServiceSpec(False, "done")
401098
def delete(self, model, commit=True):
        
        self.is_instance(model)
        db.session.delete(model)
        if commit:
            db.session.commit()

        return model
196624
def delete_one(self, query):
        
        item = self.find_one(query)
        result = self.table.remove(where(u'_id') == item[u'_id'])

        return DeleteResult(raw_result=result)
75213
def drop_database(self, name, deleteData, cascade):
    
    self.send_drop_database(name, deleteData, cascade)
    self.recv_drop_database()
1360725
def delete_individual(self, ind_obj):
        
        logger.info("Deleting individual {0} from database"
                    .format(ind_obj.ind_id))
        self.session.delete(ind_obj)
        self.save()
        return ind_obj
706090
public function delete()
    {
        $this->brokenOnDelete = true;
        $this->onBeforeDelete();
        if ($this->brokenOnDelete) {
            user_error(static::class . " has a broken onBeforeDelete() function."
                . " Make sure that you call parent::onBeforeDelete().", E_USER_ERROR);
        }

        // Deleting a record without an ID shouldn't do anything
        if (!$this->ID) {
            throw new LogicException("DataObject::delete() called on a DataObject without an ID");
        }

        // TODO: This is quite ugly.  To improve:
        //  - move the details of the delete code in the DataQuery system
        //  - update the code to just delete the base table, and rely on cascading deletes in the DB to do the rest
        //    obviously, that means getting requireTable() to configure cascading deletes ;-)
        $srcQuery = DataList::create(static::class)
            ->filter('ID', $this->ID)
            ->dataQuery()
            ->query();
        $queriedTables = $srcQuery->queriedTables();
        $this->extend('updateDeleteTables', $queriedTables, $srcQuery);
        foreach ($queriedTables as $table) {
            $delete = SQLDelete::create("\"$table\"", array('"ID"' => $this->ID));
            $this->extend('updateDeleteTable', $delete, $table, $queriedTables, $srcQuery);
            $delete->execute();
        }
        // Remove this item out of any caches
        $this->flushCache();

        $this->onAfterDelete();

        $this->OldID = $this->ID;
        $this->ID = 0;
    }
879740
def delete_from_table(table,condition)
    raise ArgumentError if !table
    quests,vals = Database.make_where_params(condition,'AND')
    query = "DELETE FROM \"#{table}\" WHERE #{quests}"
    execute_sql query, vals
  end
1327176
def delete_database(self, dbname):
        
        db = self._DATABASE_CLASS(self, dbname)
        if not db.exists():
            raise CloudantClientException(404, dbname)
        db.delete()
        if dbname in list(self.keys()):
            super(CouchDB, self).__delitem__(dbname)
969903
def delete_name(name):
    '''  '''
    session = create_session()
    try:
        user = session.query(User).filter_by(name=name).first()
        session.delete(user)
        session.commit()
    except SQLAlchemyError, e:
        session.rollback()
        raise bottle.HTTPError(500, "Database Error", e)
    finally:
        session.close()
507387
async def remove(self, *instances, using_db=None) -> None:
        
        db = using_db if using_db else self.model._meta.db
        if not instances:
            raise OperationalError("remove() called on no instances")
        through_table = Table(self.field.through)

        if len(instances) == 1:
            condition = (getattr(through_table, self.field.forward_key) == instances[0].id) & (
                getattr(through_table, self.field.backward_key) == self.instance.id
            )
        else:
            condition = (getattr(through_table, self.field.backward_key) == self.instance.id) & (
                getattr(through_table, self.field.forward_key).isin([i.id for i in instances])
            )
        query = db.query_class.from_(through_table).where(condition).delete()
        await db.execute_query(str(query))
106570
def clear(**kwargs):
    

    database = kwargs.pop('database', False)
    expression = lambda target, table: table.drop(target)
    test = lambda x, tab: not database_exists(x.url) or not tab.exists(x)

    # TODO: Iterate through all engines in name set.
    if database and database_exists(engine['default'].url):
        drop_database(engine['default'].url)
        clear_cache()

    op(expression, reversed(metadata.sorted_tables), test=test,
       primary='clear', secondary='drop', **kwargs)
924368
public static function cleanupDatabase()
    {
        // Grab any extensions sitting in the database
        $rows = Symphony::Database()->fetch("SELECT `name` FROM `tbl_extensions`");

        // Iterate over each row
        if (is_array($rows) && !empty($rows)) {
            foreach ($rows as $r) {
                $name = $r['name'];
                $status = isset($r['status']) ? $r['status'] : null;

                // Grab the install location
                $path = self::__getClassPath($name);
                $existing_id = self::fetchExtensionID($name);

                // If it doesnt exist, remove the DB rows
                if (!@is_dir($path)) {
                    Symphony::Database()->delete("tbl_extensions_delegates", sprintf(" `extension_id` = %d ", $existing_id));
                    Symphony::Database()->delete('tbl_extensions', sprintf(" `id` = %d LIMIT 1", $existing_id));
                } elseif ($status == 'disabled') {
                    Symphony::Database()->delete("tbl_extensions_delegates", sprintf(" `extension_id` = %d ", $existing_id));
                }
            }
        }
    }