Appendix A: GDPR SQL scripts
Use the following SQL scripts when running a version of Apteco software earlier than Q1 2018. They're essentially in pairs: one to provide a count and one to execute the action.
Cascade scripts¶
CS_GDPR_Anonymise_Count.sql
- Action: Doesn't remove any records. Retrieves a distinct and non-distinct count of communications records to anonymise for a given Unique Reference Number (URN) in the Cascade database.
- Usage: Supply a URN in line 3 of the script.
CS_GDPR_Remove_Count.sql
- Action: Doesn't remove any records. Retrieves a distinct and non-distinct count of communications records to remove for a given URN in the Cascade database.
- Usage: Supply a URN in line 3 of the script.
CS_GDPR_Remove_Execute.sql
- Action: Caution: removes records. Retrieves a distinct and non-distinct count of communications records to remove for a given URN in the Cascade database, then removes them.
- Usage: Supply a URN in line 3 of the script.
Facebook scripts¶
FB_GDPR_Anonymise_Count.sql
- Action: Doesn't remove any records. Retrieves a distinct and non-distinct count of Facebook users and attributes to anonymise for a given firstname/lastname combination in the Facebook Responses database.
- Usage: Supply values for the
FirstNameandLastNamevariables in lines 3 and 4 of the script.
FB_GDPR_Anonymise_Execute.sql
-
Action: Caution: anonymises and deletes data. For a given firstname/lastname combination, sets the following table column combinations to
NULL/delete in the Facebook Responses database.Table Name Column Name Action FacebookUsersfirst_nameNull last_nameNull linkNull nameNull FacebookUserAttributesattribute_valueNull FacebookEventRSVPevent_rsvpDelete FacebookCommentsourceDelete FacebookLikelikeDelete FacebookSharedPostsharedpostDelete -
Usage: Supply values for the
FirstNameandLastNamevariables in lines 3 and 4 of the script.
FB_GDPR_Remove_Count.sql
- Action: Doesn't remove any records. Retrieves a distinct and non-distinct count of Facebook users and attributes for a given firstname/lastname combination.
- Usage: Supply values for the
FirstNameandLastNamevariables in lines 3 and 4 of the script.
FB_GDPR_Remove_Execute.sql
-
Action: Caution: deletes data. Sets the following table/column combinations to
NULL/delete in the Facebook Responses database.Table Name Column Name Action FacebookUsersfirst_nameDelete last_nameDelete linkDelete nameDelete FacebookUserAttributesattribute_valueDelete FacebookEventRSVPevent_rsvpDelete FacebookCommentsourceDelete FacebookLikelikeDelete FacebookSharedPostsharedpostDelete -
Usage: Supply values for the
FirstNameandLastNamevariables in lines 3 and 4 of the script.
PeopleStage scripts¶
PS_GDPR_Anonymise_Count.sql
- Action: Doesn't remove any records. Retrieves distinct and non-distinct counts of records that would be anonymised for a given URN and Email Address from the Communications, CommunicationsTrackingHistory, EmailResponse, EmailResponseDetails, and LiveData tables.
- Usage: Supply values for the
UrnandEmailvariables in lines 6 and 7 of the script.
PS_GDPR_Anonymise_Execute.sql
-
Action: Caution: removes data. For a given URN and Email Address combination, performs the following table/column actions.
Table Name Column Name Action CommunicationsTrackingHistoryContentItemValueNull EmailResponseDetailsValueDelete EmailResponseURNDelete EmailDelete StateHistoryExternalDataColumnValueDelete -
Usage: Supply values for the
UrnandEmailvariables in lines 6 and 7 of the script.
PS_GDPR_Remove_Count.sql
- Action: Doesn't remove any records. Retrieves distinct and non-distinct counts of records it would remove for a given URN and Email Address.
- Usage: Supply values for the
UrnandEmailvariables in lines 6 and 7 of the script.
PS_GDPR_Remove_Execute.sql
-
Action: Caution: removes data. For a given URN and Email Address combination, performs the following table/column actions.
Table Name Column Name Action StateHistoryAll items Delete PoolAll items Delete JourneyHistoryAll items Delete CommunicationsAll items Delete CommunicationsTrackingHistoryAll items Delete EmailResponseDetailsAll items Delete EmailResponseAll items Delete StateHistoryExternalDataAll items Delete -
Usage: Supply values for the
UrnandEmailvariables in lines 6 and 7 of the script.
Twitter scripts¶
TW_GDPR_Anonymise_Count.sql
- Action: Doesn't remove any records. Retrieves distinct and non-distinct counts of records that would be anonymised for a given Twitter FullName and TwitterUsername from the user table of the Twitter response database.
- Usage: Supply values for the
FullNameandTwitterUsernamevariables in lines 3 and 4 of the script.
TW_GDPR_Anonymise_Execute.sql
-
Action: Caution: removes data and records from the Twitter response database.
Table Name Column Name Action userscreen_nameNull nameNull descriptionNull urlNull profile_image_urlNull profile_image_url_httpsNull tweetAll items Delete retweetAll items Delete mention_replyAll items Delete followerAll items Delete direct_messageAll items Delete -
Usage: Supply values for the
FullNameandTwitterUsernamevariables in lines 3 and 4 of the script.
TW_GDPR_Remove_Count.sql
- Action: Doesn't remove any records. Retrieves distinct and non-distinct counts of records it would remove for a given Twitter FullName and TwitterUsername.
- Usage: Supply values for the
FullNameandTwitterUsernamevariables in lines 3 and 4 of the script.
TW_GDPR_Remove_Execute.sql
-
Action: Caution: removes records from the Twitter response database.
Table Name Column Name Action userAll items Null tweetAll items Delete retweetAll items Delete mention_replyAll items Delete followerAll items Delete direct_messageAll items Delete -
Usage: Supply values for the
FullNameandTwitterUsernamevariables in lines 3 and 4 of the script.