Delete dataset from upload schema
17306
def delete_publication(self, pub_id, schema='upload'):
        
        if schema == 'upload':
            user = 'upload_admin'
        elif schema == 'public':
            user = 'catroot'

        if not self.user == 'catroot':
            assert self.user == user, \
                "You don't have permission to perform this operation"

        con = self.connection or self._connect()
        cur = con.cursor()

        self.stdout.write('Deleting publication: {pub_id} from {schema}\n'
                          .format(pub_id=pub_id, schema=schema))

        cur.execute("""SELECT to_regclass('keys');""")
        if cur.fetchone()[0] is not None:  # remove data from old tables
            old_tables = ['text_key_values', 'number_key_values',
                          'species', 'keys']
            for table in old_tables:
                cur.execute(
                    """DELETE FROM {schema}.{table}"""
                    .format(schema=schema,
                            table=table))

        cur.execute(
            """DELETE FROM {schema}.systems
            WHERE unique_id in
            (SELECT distinct ase_id
            FROM {schema}.publication_system
            WHERE pub_id = '{pub_id}')"""
            .format(schema=schema,
                    pub_id=pub_id))

        cur.execute(
            """ DELETE FROM {schema}.publication
            WHERE pub_id = '{pub_id}'"""
            .format(schema=schema,
                    pub_id=pub_id))

        self.stdout.write('Delete complete\n')

        if self.connection is None:
            con.commit()
            con.close()
        return
252597
def delete_records(keep=20):
    """"""
    sql = "SELECT * from records where is_deleted<>1 ORDER BY id desc LIMIT -1 offset {}".format(keep)
    assert isinstance(g.db, sqlite3.Connection)
    c = g.db.cursor()
    c.execute(sql)
    rows = c.fetchall()
    for row in rows:
        name = row[1]
        xmind = join(app.config['UPLOAD_FOLDER'], name)
        xml = join(app.config['UPLOAD_FOLDER'], name[:-5] + 'xml')

        for f in [xmind, xml]:
            if exists(f):
                os.remove(f)

        sql = 'UPDATE records SET is_deleted=1 WHERE id = ?'
        c.execute(sql, (row[0],))
        g.db.commit()
880306
def remove_data(self, request, pk=None):
        """"""
        collection = self.get_object()

        if 'ids' not in request.data:
            return Response({"error": "`ids`parameter is required"}, status=status.HTTP_400_BAD_REQUEST)

        for data_id in request.data['ids']:
            collection.data.remove(data_id)

        return Response()
1149041
function remove(connections, params, cb) {
  var failed = validate(params).has(CONSTANTS.DATA_TARGET_ID);

  if (failed) {
    return cb(buildErrorResponse({error: new Error("An ID Parameter Is Required To Remove A Data Target"), code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS}));
  }

  if (!misc.checkId(params._id)) {
    return cb(buildErrorResponse({error: new Error("Invalid ID Paramter"), code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS}));
  }

  async.waterfall([
    function findAssociatedForms(cb) {
      checkFormsUsingDataTarget(connections, params, cb);
    },
    function verifyNoFormsAssociated(updatedDataTarget, cb) {
      //If there is more than one form using this data target, then do not delete it.

      if (updatedDataTarget.forms.length > 0) {
        return cb(buildErrorResponse({
          error: new Error("Forms Are Associated With This Data Target. Please Disassociate Forms From This Data Target Before Deleting."),
          code: ERROR_CODES.FH_FORMS_UNEXPECTED_ERROR
        }));
      }

      return cb(undefined, updatedDataTarget);
    },
    function processResponse(updatedDataTarget, cb) {
      //Removing The Data Target
      var DataTarget = models.get(connections.mongooseConnection, models.MODELNAMES.DATA_TARGET);

      DataTarget.remove({_id: updatedDataTarget._id}, function(err) {
        if (err) {
          return cb(buildErrorResponse({
            error: err,
            userDetail: "Unexpected Error When Removing A Data Target",
            code: ERROR_CODES.FH_FORMS_UNEXPECTED_ERROR
          }));
        }

        //Data Target Removed Successfully
        return cb();
      });
    }
  ], cb);

}
726886
@Override
    public void dropSchema()
    {
        for (TableInfo tableInfo : tableInfos)
        {
            try
            {
                client.deleteTable(tableInfo.getTableName());
            }
            catch (Exception ex)
            {
                logger.error("Error during deleting tables in kudu, Caused by: ", ex);
                throw new SchemaGenerationException(ex, "Kudu");
            }
        }
    }
985095
def drop(self, force=False):
        
        if not self.exists:
            logger.info("Schema named `{database}` does not exist. Doing nothing.".format(database=self.database))
        elif (not config['safemode'] or
              force or
              user_choice("Proceed to delete entire schema `%s`?" % self.database, default='no') == 'yes'):
            logger.info("Dropping `{database}`.".format(database=self.database))
            try:
                self.connection.query("DROP DATABASE `{database}`".format(database=self.database))
                logger.info("Schema `{database}` was dropped successfully.".format(database=self.database))
            except pymysql.OperationalError:
                raise DataJointError("An attempt to drop schema `{database}` "
                                     "has failed. Check permissions.".format(database=self.database))
1159713
def _strip_schema(url):
    """"""
    result = parse_url(url, allow_fragments=False)
    return result.netloc + result.path
1279118
def delete(self, id):
        """"""
        # url('DataStores', id=ID)
        result = meta.Session.query(DataStore).get(id)
        meta.Session.delete(result)
        meta.Session.commit()

        response.status = 204
        # remove content-type from response headers so that webtest won't get confused
        # http://groups.google.com/group/pylons-discuss/browse_thread/thread/1267650386ae521b
        del response.headers['content-type']
1083060
def _remove_incomplete_upload(self, bucket_name, object_name, upload_id):
        

        # No reason to store successful response, for errors
        # relevant exceptions are thrown.
        self._url_open('DELETE', bucket_name=bucket_name,
                       object_name=object_name, query={'uploadId': upload_id},
                       headers={})
661073
function DeleteMultipartUpload(fileUpload) {
            fileUpload.info('will attempt to abort the upload');

            fileUpload.abortParts();

            var request = {
                method: 'DELETE',
                path: '?uploadId=' + fileUpload.uploadId,
                x_amz_headers: fileUpload.xAmzHeadersCommon,
                success404: true,
                step: 'abort'
            };

            SignedS3AWSRequest.call(this, fileUpload, request);
        }
1043207
def delete(self, dataset_name):
        
        url = "{0}/{1}".format(self._cached_datasets_url, dataset_name)
        self._get_json(HTTPMethods.DELETE, url, self._get_master_key())
        return True
458298
def remove(self, bundle):
        
        from six import string_types

        if isinstance(bundle, string_types):
            bundle = self.bundle(bundle)

        self.database.remove_dataset(bundle.dataset)
470846
def delete(name, dry_run, verbose):
    """"""
    collection = Collection.query.filter_by(name=name).one()
    if verbose:
        tr = LeftAligned(traverse=AttributeTraversal())
        click.secho(tr(collection), fg='red')
    db.session.delete(collection)
952379
public static void deleteSchema(GeoPackageCore geoPackage, String table) {

		DataColumnsDao dataColumnsDao = geoPackage.getDataColumnsDao();
		try {
			if (dataColumnsDao.isTableExists()) {
				dataColumnsDao.deleteByTableName(table);
			}
		} catch (SQLException e) {
			throw new GeoPackageException(
					"Failed to delete Schema extension. GeoPackage: "
							+ geoPackage.getName() + ", Table: " + table, e);
		}

	}
580244
function remove(connections, params, cb) {
  var failed = validate(params).has(CONSTANTS.DATA_SOURCE_ID);

  if (failed) {
    return cb(buildErrorResponse({error: new Error("An ID Parameter Is Required To Remove A Data Source"), code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS}));
  }

  if (!misc.checkId(params[CONSTANTS.DATA_SOURCE_ID])) {
    return cb(buildErrorResponse({error: new Error("Invalid ID Parameter"), code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS}));
  }
  var DataSource = models.get(connections.mongooseConnection, models.MODELNAMES.DATA_SOURCE);

  async.waterfall([
    function findAssociatedForms(cb) {
      checkFormsUsingDataSource(connections, params, cb);
    },
    function verifyNoFormsAssociated(updatedDataSource, cb) {
      //If there are any forms using this data source, then do not delete it.
      logger.debug("Remove Data Source ", {updatedDataSource: updatedDataSource});

      if (updatedDataSource.forms.length > 0) {
        return cb(buildErrorResponse({
          error: new Error("Forms Are Associated With This Data Source. Please Disassociate Forms From This Data Source Before Deleting."),
          code: ERROR_CODES.FH_FORMS_UNEXPECTED_ERROR
        }));
      }

      return cb(undefined, updatedDataSource);
    },
    function processResponse(updatedDataSource, cb) {
      //Removing The Data Source

      DataSource.remove({_id: updatedDataSource._id}, function(err) {
        if (err) {
          return cb(buildErrorResponse({
            error: err,
            userDetail: "Unexpected Error When Removing A Data Source",
            code: ERROR_CODES.FH_FORMS_UNEXPECTED_ERROR
          }));
        }

        //Data Source Removed Successfully
        return cb(undefined, updatedDataSource);
      });
    },
    function removeAduditLogs(updatedDataSource, cb) {
      DataSource.clearAuditLogs(updatedDataSource._id, cb);
    }
  ], cb);
}
929017
def delete(self):
        """"""
        ret = False
        q = self.query
        pk = self.pk
        if pk:
            pk_name = self.schema.pk.name
            self.query.is_field(pk_name, pk).delete()
            setattr(self, pk_name, None)

            # mark all the fields that still exist as modified
            self.reset_modified()
            for field_name in self.schema.fields:
                if getattr(self, field_name, None) != None:
                    self.modified_fields.add(field_name)

            ret = True

        return ret
736474
public void clearUploadTempData() {
        LOG.debug("Cleaning up temp data...");
        // delete file system zombies
        for (final FileUploadProgress fileUploadProgress : getAllFileUploadProgressValuesFromOverallUploadProcessList()) {
            if (!StringUtils.isBlank(fileUploadProgress.getFilePath())) {
                final boolean deleted = FileUtils.deleteQuietly(new File(fileUploadProgress.getFilePath()));
                if (!deleted) {
                    LOG.warn("TempFile was not deleted: {}", fileUploadProgress.getFilePath());
                }
            }
        }
        clearFileStates();
    }