GoogleCloudPlatform / database-assessment

Database Migration Assessment
https://googlecloudplatform.github.io/database-assessment/
Apache License 2.0
56 stars 34 forks source link

feat: column masking additions and file name masking #362

Closed ssenior45 closed 3 months ago

ssenior45 commented 4 months ago

This PR adds column masking for

It also masks the collection key in both the archive file and the CSV files within the archive and keeps this key consistent between the two.

In dealing with PKEY and DMA_SOURCE_ID masking I added wildcard functionality to apply to all files.

I've reviewed the Oracle canonical tables and added the columns that need to be masked.

I wasn't sure if the oracle_dataguard table might have some hostname info in the connect string that might need to be looked at. I haven't dealt with this here.

I've manually tested this as far as possible but it does need more testing by another person IMO.

Finally, there are some formatting and minor changes from running the ruff linter and formatter over the file.

Example maskings

Filename collection key

Original

opdb_oracle_UseDiagnostics__121_4.3.29_rac194.wpuziewicz.com_O1211CDB_o1211cdb_013024142321.zip
opdb__archlogs__121_4.3.29_rac194.wpuziewicz.com_O1211CDB_o1211cdb_013024142321.csv

Masked

opdb_oracle_UseDiagnostics__121_4.3.29_db-76.cook.com_DB-SEASON_INST-CENTURY_013024142321.zip
opdb__archlogs__121_4.3.29_db-76.cook.com_DB-SEASON_INST-CENTURY_013024142321.csv

_PKEY, INSTANCE_NAME, HOST_NAME, DMA_SOURCEID

Original

$ head sample-input/unzipped/opdb__dbinstances__121_4.3.29_rac194.wpuziewicz.com_O1211CDB_o1211cdb_013024142321.csv 
PKEY|INST_ID|INSTANCE_NAME|HOST_NAME|VERSION|STATUS|DATABASE_STATUS|INSTANCE_ROLE|DMA_SOURCE_ID|DMA_MANUAL_ID
rac194.wpuziewicz.com_O1211CDB_013024142321|1|o1211cdb|rac194.wpuziewicz.com|12.1.0.1.0|OPEN|ACTIVE|PRIMARY_INSTANCE|rac194.wpuziewicz.com_o1211cdb_1238643283|'NA'

Masked

$ head sample-output/unzipped/opdb__dbinstances__121_4.3.29_db-76.cook.com_DB-SEASON_INST-CENTURY_013024142321.csv 
PKEY|INST_ID|INSTANCE_NAME|HOST_NAME|VERSION|STATUS|DATABASE_STATUS|INSTANCE_ROLE|DMA_SOURCE_ID|DMA_MANUAL_ID
db-71.love.com_DB-STAND_030624180436|1|INST-TURN|desktop-50.white-duarte.com|12.1.0.1.0|OPEN|ACTIVE|PRIMARY_INSTANCE|email-85.jones-phillips.com_INST-PLAYER_6896483446|'NA'

_DATABASENAME

Original

$ head sample-input/unzipped/opdb__pdbsinfo__121_4.3.29_rac194.wpuziewicz.com_O1211CDB_o1211cdb_013024142321.csv 
PKEY|DBID|PDB_ID|PDB_NAME|STATUS|LOGGING|CON_ID|CON_UID|EBS_OWNER|SIEBEL_OWNER|PSFT_OWNER|RDS_FLAG|OCI_AUTONOMOUS_FLAG|DBMS_CLOUD_PKG_INSTALLED|APEX_INSTALLED|SAP_OWNER|SGA_ALLOCATED_BYTES|PGA_USED_BYTES|PGA_ALLOCATED_BYTES|PGA_MAX_BYTES|DMA_SOURCE_ID|DMA_MANUAL_ID
rac194.wpuziewicz.com_O1211CDB_013024142321|74834048|2|PDB$SEED|NORMAL|N/A|1|74834048|||||||||1067118432|12391574|22969854|93027838|rac194.wpuziewicz.com_o1211cdb_1238643283|'NA'
rac194.wpuziewicz.com_O1211CDB_013024142321|1238643283|1|CDB$ROOT|NORMAL|LOGGING|1|1|||||||||1067118432|12391574|22969854|93027838|rac194.wpuziewicz.com_o1211cdb_1238643283|'NA'
rac194.wpuziewicz.com_O1211CDB_013024142321|2755328021|5|O12PDB3|NORMAL|N/A|1|2755328021|||||||||1067118432|12391574|22969854|93027838|rac194.wpuziewicz.com_o1211cdb_1238643283|'NA'
rac194.wpuziewicz.com_O1211CDB_013024142321|2805019465|4|O12PDB2|NORMAL|N/A|1|2805019465|||||||||1067118432|12391574|22969854|93027838|rac194.wpuziewicz.com_o1211cdb_1238643283|'NA'
rac194.wpuziewicz.com_O1211CDB_013024142321|3208678270|3|O12PDB1|NORMAL|N/A|1|3208678270|||||||||1067118432|12391574|22969854|93027838|rac194.wpuziewicz.com_o1211cdb_1238643283|'NA'

Masked

$ head sample-output/unzipped/opdb__pdbsinfo__121_4.3.29_db-76.cook.com_DB-SEASON_INST-CENTURY_013024142321.csv 
PKEY|DBID|PDB_ID|PDB_NAME|STATUS|LOGGING|CON_ID|CON_UID|EBS_OWNER|SIEBEL_OWNER|PSFT_OWNER|RDS_FLAG|OCI_AUTONOMOUS_FLAG|DBMS_CLOUD_PKG_INSTALLED|APEX_INSTALLED|SAP_OWNER|SGA_ALLOCATED_BYTES|PGA_USED_BYTES|PGA_ALLOCATED_BYTES|PGA_MAX_BYTES|DMA_SOURCE_ID|DMA_MANUAL_ID
db-71.love.com_DB-STAND_030624180436|74834048|2|DB-LATE|NORMAL|N/A|1|74834048|||||||||1067118432|12391574|22969854|93027838|email-85.jones-phillips.com_INST-PLAYER_6896483446|'NA'
db-71.love.com_DB-STAND_030624180436|1238643283|1|DB-CUT|NORMAL|LOGGING|1|1|||||||||1067118432|12391574|22969854|93027838|email-85.jones-phillips.com_INST-PLAYER_6896483446|'NA'
db-71.love.com_DB-STAND_030624180436|2755328021|5|DB-WRONG|NORMAL|N/A|1|2755328021|||||||||1067118432|12391574|22969854|93027838|email-85.jones-phillips.com_INST-PLAYER_6896483446|'NA'
db-71.love.com_DB-STAND_030624180436|2805019465|4|DB-LATER|NORMAL|N/A|1|2805019465|||||||||1067118432|12391574|22969854|93027838|email-85.jones-phillips.com_INST-PLAYER_6896483446|'NA'
db-71.love.com_DB-STAND_030624180436|3208678270|3|DB-INVOLVE|NORMAL|N/A|1|3208678270|||||||||1067118432|12391574|22969854|93027838|email-85.jones-phillips.com_INST-PLAYER_6896483446|'NA'

Note how each PDB has a unique masked name.

google-cla[bot] commented 4 months ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

cofin commented 4 months ago

Thanks, @ssenior45

Can you sign the CLA for contributions?

ssenior45 commented 3 months ago

Thanks, @ssenior45

Can you sign the CLA for contributions?

This is now actioned.