I see in other threads, that it's not possible to delete individual records from Data Extension because, without a primary key, individual records couldn't be identified.
Question 1: Is this the Salesforce Restriction or general limitation of any database? I mean can't we delete the rows which match filter?
Question 2: I see that when we delete a contact from "All Contacts" in the marketing cloud, then the records get deleted from sendable data extensions even when there is no primary key set. How salesforce is doing this? If I manage to convert non-sendable data extension to sendable data extension without primary key set, can individual records be deleted?
Question 3: Using Java FuelSDK, I managed to retrieve DataExtensionRow having column "_customObjectKey" which is having unique integer value for each row. Does it mean that we can delete rows using this hidden column name "_customObjectKey"?
Question 4: Can we set primary key, when records are already filled? I observed it sometimes allowed, sometimes not from salesforce Dashboard.
Question 5: If cloning Data Extension is the only possible way, then is there any provision in Salesforce to ensure that transaction is atomic and mutually exclusive? I mean what would happen when two or more parties try to write at the same time?
Based on answer given below for Q1 and Q2, it says it is possible to delete data from data extension based on filter. I was trying to delete all records which matches particular e-mail address using fuelSDK-Java:-
ETClient etClient = getClient(); // 1. Retrieve the data extension ETResponse<ETDataExtension> response = etClient.retrieve(ETDataExtension.class, "key=XXXX"); ETDataExtension de = response.getObject(); System.out.println("ETDataExtension retrieved : " + de.toString()); // 2. Retrieve the rows with specified filter ETResponse<ETDataExtensionRow> rowETResponse = de.select("emailaddress="+email); // 3. Get rows id _customObjectKey System.out.println("etRowResponse : " + rowETResponse.toString()); // 4. Delete that row ETResponse<ETDataExtensionRow> deleteResponse = de.delete(rowETResponse.getObjects()); System.out.println("deleteResponse : " + deleteResponse.toString());
It successfully retrieves the rows. But it is giving error when trying to delete :
individualResults = [com.exacttarget.fuelsdk.ETResult[ status = ERROR responseCode = Error responseMessage = Keys Not Found errorCode = 70000 ]]
However when I used DE having primary key, then rows successfully deleted.