Clear the third relationship table, but not the ModelA or ModelB
191567
def clear(self, *objs):
        
        if objs:
            keys = get_objs_columns(objs, self.realfieldb)
            self.do_(self.table.delete(self.get_default_condition() & (self.table.c[self.fieldb].in_(keys))))
        else:
            self.do_(self.table.delete(self.get_default_condition()))
        #cache [] to _STORED_attr_name
        setattr(self.instance, self.store_key, Lazy)
712429
def drop_columns(self, model, *names, **kwargs):
        """"""
        fields = [field for field in model._meta.fields.values() if field.name in names]
        cascade = kwargs.pop('cascade', True)
        for field in fields:
            self.__del_field__(model, field)
            if field.unique:
                index_name = make_index_name(model._meta.table_name, [field.column_name])
                self.ops.append(self.migrator.drop_index(model._meta.table_name, index_name))
            self.ops.append(
                self.migrator.drop_column(
                    model._meta.table_name, field.column_name, cascade=cascade))
        return model
400090
def remove(self, models):
        
        models = self._check_model_types(models)
        for model in models:
            if model in self._selected:
                self._selected.remove(model)
1351096
private function emptyTables()
    {
        foreach ($this->dataMigrationTypeProvider->getTypes() as $migrationType) {
            /** @var AbstractDataMigration $migrationType */
            $tableName = $this->resourceConnection->getTableName($migrationType->getTableName());
            $this->resourceConnection->getConnection()->delete($tableName);

            $this->resourceConnection->getConnection()
                ->query(sprintf('ALTER TABLE %s AUTO_INCREMENT = 1', $tableName));
        }
    }
894059
def invalidate_model_cache(self):
        
        logger.info('Invalidating cache for table {0}'.format(self.model._meta.db_table))
        if django.VERSION >= (1, 8):
            related_tables = set(
                [f.related_model._meta.db_table for f in self.model._meta.get_fields()
                 if ((f.one_to_many or f.one_to_one) and f.auto_created)
                 or f.many_to_one or (f.many_to_many and not f.auto_created)])
        else:
            related_tables = set([rel.model._meta.db_table for rel in self.model._meta.get_all_related_objects()])
            # temporary fix for m2m relations with an intermediate model, goes away after better join caching
            related_tables |= set([field.rel.to._meta.db_table for field in self.model._meta.fields if issubclass(type(field), RelatedField)])

        logger.debug('Related tables of model {0} are {1}'.format(self.model, related_tables))
        update_model_cache(self.model._meta.db_table)
        for related_table in related_tables:
            update_model_cache(related_table)
180951
function(models, options) {
      options = _.extend({}, options);
      var singular = !_.isArray(models);
      models = singular ? [models] : models.slice();
      var removed = this._removeModels(models, options);
      if (!options.silent && removed.length) {
        options.changes = {added: [], merged: [], removed: removed};
        this.trigger('update', this, options);
      }
      return singular ? removed[0] : removed;
    }
115362
def drop(self, ex):
    ""
    # todo: factor out inheritance logic (for readability)
    if ex.name not in self:
      if ex.ifexists: return
      raise KeyError(ex.name)
    table_ = self[ex.name]
    parent = table_.parent_table
    if table_.child_tables:
      if not ex.cascade:
        raise table.IntegrityError('delete_parent_without_cascade',ex.name)
      self.cascade_delete(ex.name)
    else: del self[ex.name]
    if parent: parent.child_tables.remove(table_)
1000215
def clear(self):
        """"""

        # Create set of candidate_subclasses associated with each mention_subclass
        cand_subclasses = set()
        for mentions, tablename in [
            (_[1][0], _[1][1]) for _ in candidate_subclasses.values()
        ]:
            for mention in mentions:
                if mention in self.mention_classes:
                    cand_subclasses.add(tablename)

        # First, clear all the Mentions. This will cascade and remove the
        # mention_subclasses and corresponding candidate_subclasses.
        for mention_class in self.mention_classes:
            logger.info(f"Clearing table: {mention_class.__tablename__}")
            self.session.query(Mention).filter_by(
                type=mention_class.__tablename__
            ).delete(synchronize_session="fetch")

        # Next, clear the Candidates. This is done manually because we have
        # no cascading relationship from candidate_subclass to Candidate.
        for cand_subclass in cand_subclasses:
            logger.info(f"Cascading to clear table: {cand_subclass}")
            self.session.query(Candidate).filter_by(type=cand_subclass).delete(
                synchronize_session="fetch"
            )
297921
def relieve_all_models(self):
        
        map(self.relieve_model, list(self.__registered_models))
        self.__registered_models.clear()
1143507
def clear_mappers():
    
    # Remove our hybrid property constructs.
    for mpr, is_primary in _mapper_registry.items():
        if is_primary:
            for attr_name in ('id', 'slug'):
                try:
                    attr = object.__getattribute__(mpr.class_, attr_name)
                    if isinstance(attr, hybrid_property):
                        if attr_name == 'id':
                            delattr(mpr.class_, attr_name)
                        else:
                            setattr(mpr.class_, attr_name, attr.descriptor)
                except AttributeError:
                    pass
    sa_clear_mappers()
687585
private void removeHasOneToBothPrimaryAndForeignKey() {
		String[] primaryKeys = model.getPrimaryAttributes();
		String[] hasOne = model.getHasOne();
		String[] hasOneLocal = model.getHasOneLocalColumn();
		String[] hasOneReferenced = model.getHasOneReferencedColumn();
		for(String pk : primaryKeys){
			int pkIndex = CStringUtils.indexOf(hasOneLocal, pk);
			if(pkIndex >= 0){
				System.out.println("\n"+pk+" is a primary key of ["+model.getTableName()+"] ("+hasOneLocal[pkIndex]+")"
						+ "and foreign key to ["+hasOne[pkIndex]+"]("+hasOneReferenced[pkIndex]+")");
				System.out.println("removing ["+hasOne[pkIndex]+"] from ["+model.getTableName()+"]");
				model = removeFromHasOne(model, hasOne[pkIndex]);
			}
		}
	}
621984
function(models, options) {
      if (_.isArray(models)) {
        for (var i = 0, l = models.length; i < l; i++) {
          this._remove(models[i], options);
        }
      } else {
        this._remove(models, options);
      }
      return this;
    }
735999
def delete_model(self, model):
        """"""
        if SessionActivity.is_current(sid_s=model.sid_s):
            flash('You could not remove your current session', 'error')
            return
        delete_session(sid_s=model.sid_s)
        db.session.commit()
188119
protected function unloadDoctrineEntities()
    {
        $this->attributeKeysAndControllers = null;
        $app = Application::getFacadeApplication();
        $entityManager = $app->make(EntityManagerInterface::class);
        $entityManager->clear();
        $category = $this->getCategory();
        if ($category !== null) {
            $categoryClass = ClassUtils::getClass($category);
            if (!$entityManager->getMetadataFactory()->isTransient($categoryClass)) {
                $entityManager->merge($category);
            }
        }
    }
529299
private void doDelete(DBIDRef id) {
    // Remove id
    ids.remove(id);
    // Remove from all representations.
    for(Relation<?> relation : relations) {
      // ID has already been removed, and this would loop...
      if(relation == idrep) {
        continue;
      }
      if(!(relation instanceof ModifiableRelation)) {
        throw new AbortException("Non-modifiable relations have been added to the database.");
      }
      ((ModifiableRelation<?>) relation).delete(id);
    }
    DBIDFactory.FACTORY.deallocateSingleDBID(id);
  }
958510
private void removeFromInverseAssociations(
			Tuple resultset,
			int tableIndex,
			Serializable id,
			SharedSessionContractImplementor session) {
		new EntityAssociationUpdater( this )
				.id( id )
				.resultset( resultset )
				.session( session )
				.tableIndex( tableIndex )
				.propertyMightRequireInverseAssociationManagement( propertyMightBeMainSideOfBidirectionalAssociation )
				.removeNavigationalInformationFromInverseSide();
	}
865869
def remove(self,obj):
        
        relationship_table = self.params['relationship_table']
        with self.obj.backend.transaction(implicit = True):
            condition = and_(relationship_table.c[self.params['related_pk_field_name']] == obj.pk,
                             relationship_table.c[self.params['pk_field_name']] == self.obj.pk)
            self.obj.backend.connection.execute(delete(relationship_table).where(condition))
            self._queryset = None