CMDBuild Forum

Bulk DELETE of cards - HOW?

I just recently started to play with CMDBuild. I see a bulk upload procedure and bulk update too. But I couldn't find a way to DELETE a bulk of records. Something like apply filter to a view and then DELETE all cards - the same way as "update all" works. Is there a proper way to do it other than writing code for SOAP API?

 

The bulk delete function has already been requested from other users and is in the list of developments to be planned.
This function is a bit more complex to implement than those of insert and update because it must be decided how to handle the relations of the cards removed (just disconnect, or delete them in cascade mode, or both modes according to a new parameter in the domain definition ?).

The deletion should be however only logic because one of the most important CMDBuild features is to keep in the CMDB all versions of all the card managed in the system (with all the information valid at that time, the user who made the change and the date of the change).

CMDBuild Team

Anything new on this topic?
 
I have the following issue:
- I did a bulk CSV import
- Then I found some errors in the import (wrong data)
- Now I wanted to bulk delete these cards
- I did not find a way to perform this task
 
 
Previously Tecnoteca wrote:

The bulk delete function has already been requested from other users and is in the list of developments to be planned.
This function is a bit more complex to implement than those of insert and update because it must be decided how to handle the relations of the cards removed (just disconnect, or delete them in cascade mode, or both modes according to a new parameter in the domain definition ?).

The deletion should be however only logic because one of the most important CMDBuild features is to keep in the CMDB all versions of all the card managed in the system (with all the information valid at that time, the user who made the change and the date of the change).

CMDBuild Team

 

Hi Volker,
 
of course it exists a low-level DIRTY way to delete the data : via SQL.
 
SQL is a "dirty" way because as Tecnoteca explained, in CMDBuild the "deletion" is a "logic" concept, when you decide to delete a card by CMDBuild all the relations over the existings domains have to be handled too. In a CMDBuild database there are a lot of triggers that have the mission to maintain data integrity and history.
 
However, since you want to delete the just imported data without caring about the history (is not it?)  you could bypass this logic using directly SQL, but ... YOU NEED TO KNOW WHAT YOU ARE DOING.
 
The simple case is when you did a bulk CSV import in an EMPTY (!!) class but you have not yet created relations between such cards and some others. In this case you could empty completely the table running the "truncate" SQL statement (truncate "tablename") in some SQL client (PgAdmin3 is a good choice)
 
In the similar case in which you want to delete only a part of them, and they are NOT in relation with others cards then you can delete phisically (pay attention, i told phisically not logically !!!) with a query like :
 
alter table "tablename" disable trigger all;
delete from "tablename" where booleanWhereClause;
delete from "tablename_history" where "CurrentId" not in (select "Id" from "tablename"  );
alter table "tablename" enable trigger all;
 
More and more complicated is the case in which the cards you want to delete  have relations, in such case you have to "clean" the domains "Map" tables, but I hope is not your case ;-)
 
Alessandro Grillini
 
 
Previously Volker wrote:
Anything new on this topic?
 
I have the following issue:
- I did a bulk CSV import
- Then I found some errors in the import (wrong data)
- Now I wanted to bulk delete these cards
- I did not find a way to perform this task
 
 
Previously Tecnoteca wrote:

The bulk delete function has already been requested from other users and is in the list of developments to be planned.
This function is a bit more complex to implement than those of insert and update because it must be decided how to handle the relations of the cards removed (just disconnect, or delete them in cascade mode, or both modes according to a new parameter in the domain definition ?).

The deletion should be however only logic because one of the most important CMDBuild features is to keep in the CMDB all versions of all the card managed in the system (with all the information valid at that time, the user who made the change and the date of the change).

CMDBuild Team

 

 

1 Like

Previously Tecnoteca wrote:

The bulk delete function has already been requested from other users and is in the list of developments to be planned.
This function is a bit more complex to implement than those of insert and update because it must be decided how to handle the relations of the cards removed (just disconnect, or delete them in cascade mode, or both modes according to a new parameter in the domain definition ?).

The deletion should be however only logic because one of the most important CMDBuild features is to keep in the CMDB all versions of all the card managed in the system (with all the information valid at that time, the user who made the change and the date of the change).

CMDBuild Team

some news on this?

No, there are no news and in the last few years the interest in this function has also been reduced.
It
has remained in the wishlist that we will evaluate for the design of
CMDBuild 3.0 (it is already started but will not be ready before the end
of next year).
CMDBuild Team

Previously Tecnoteca wrote:

No, there are no news and in the last few years the interest in this function has also been reduced.
It has remained in the wishlist that we will evaluate for the design of CMDBuild 3.0 (it is already started but will not be ready before the end of next year).
CMDBuild Team

Any Idea how to remove ~4000 empty cards from a failed csv-import in a table with relations?

Knowing
the database of CMDBuild our technicians operate via SQL, temporarily
disabling triggers that prevent cancellations, eliminating congruently
all possible relations and all historical records.
However, this is a risky activity because if done badly, it can create an inconsistent database.


CMDBuild Team

Previously Tecnoteca wrote:

Knowing the database of CMDBuild our technicians operate via SQL, temporarily disabling triggers that prevent cancellations, eliminating congruently all possible relations and all historical records.
However, this is a risky activity because if done badly, it can create an inconsistent database.


CMDBuild Team

 

a better solution in v3.0 will be great!

but still waiting until end of 2018..
 
any clues for solution? any plan for implementation in current version?
 
Previously Tecnoteca wrote:
Previously Tecnoteca wrote:
Knowing the database of CMDBuild our technicians operate via SQL, temporarily disabling triggers that prevent cancellations, eliminating congruently all possible relations and all historical records.
However, this is a risky activity because if done badly, it can create an inconsistent database.


CMDBuild Team

 

a better solution in v3.0 will be great!

 

I’m sorry at the moment we have no plans to implement this feature.
If you are careful you can operate via SQL.
CMDBuild Team