Skip to content

Instantly share code, notes, and snippets.

@levi-turner
Created June 24, 2020 08:02
Show Gist options
  • Save levi-turner/0f8542fb15e50de10483830731197471 to your computer and use it in GitHub Desktop.
Save levi-turner/0f8542fb15e50de10483830731197471 to your computer and use it in GitHub Desktop.
// Load all QVDs
LOAD *
FROM [lib://Data/ExtensionUsage/*.qvd] (qvd);
// Scramble users
UserScramble:
LOAD
[UserGUID] as [UserGUID],
Dual('Obfuscated User ' & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)),AutoNumber(UserId)) AS [obscuredUserId],
Dual(chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)),AutoNumber(UserDirectory)) AS [obscuredUserDirectory];
LOAD
*
Resident [users];
// Drop unscrambled table
Drop Table [users];
// Scramble apps
AppScramble:
LOAD
[UserGUID] as [UserGUID],
[AppID] as [AppID],
Dual('Obfuscated App ' & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)),AutoNumber(AppName)) AS [obscuredAppName],
Dual('Obfuscated App ' & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)),AutoNumber(UnpublishedAppName)) AS [obscuredUnpublishedAppName],
Dual('Obfuscated App ' & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)),AutoNumber(PublishedAppName)) AS [obscuredPublishedAppName],
[PublishedDate] as [PublishedDate],
[IsPublished] as [IsPublished],
Dual('Obfuscated User ' & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)),AutoNumber(AppOwnerName)) AS [obscuredAppOwnerName],
[StreamID] as [StreamID],
Dual('Obfuscated Stream ' & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)),AutoNumber(StreamName)) AS [obscuredStreamName],
Dual('Obfuscated Stream ' & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)),AutoNumber(PublishedStreamName)) AS [obscuredPublishedStreamName],
;
LOAD
*
Resident [apps];
// Drop unscrambled table
Drop Table [apps];
// Scramble sheets
SheetsScramble:
LOAD
[AppID] as [AppID],
[SheetID] as [SheetID],
[SheetIDKey] as [SheetIDKey],
Dual('Obfuscated Sheet ' & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)),AutoNumber(SheetName)) AS [obscuredSheetName],
[SheetType] as [SheetType],
[SheetPublished] as [SheetPublished],
[SheetApproved] as [SheetApproved],
[SheetOwnerID] as [SheetOwnerID],
Dual('Obfuscated User ' & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)),AutoNumber(SheetOwneruserID)) AS [obscuredSheetOwneruserID],
Dual(chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)),AutoNumber(SheetOwnerDirectory)) AS [obscuredSheetOwnerDirectory],
Dual('Obfuscated User ' & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)) & chr(round(25 * rand() + 65)),AutoNumber(SheetOwnerName)) AS [obscuredSheetOwnerName];
LOAD
*
Resident [sheets];
// Drop unscrambled table
Drop Table [sheets];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment