SAM Delete Design

1. Introduction

This design document will attempt to explain the design of a method by which records can be deleted from the Sam application's data base. The sam application is a web of many tables. This is an effort to provide a means by which records can be deleted from the database, if necessary, and leave the database in an uncorrupted state.


 

2. Goals

The clean deletion of data files from the sam application. These data files were most likely entered in error, and now need to be deleted. The Sam team would like this procedure(s) clear, understandable and secure. These procedures will need continual maintenance, as the number of tables in Sam continues to grow, and all new tables will need to be addressed in the delete scheme.


 

3. Requirements

This process will be dependent on someone being able to identify the records to be deleted. This requirement will necessitate the construction of a sql statement that selects the data files to be deleted, and verification that they are the correct data files. These processes will be written in python using the dbserver. Any and all information that can be displayed during the delete to give some indication of what is being or is potentially being deleted should be printed. Counts of each table before and after the delete should be printed as well. These print statements must be in any scripts written and are to be used for verification and historic purposes.


 

4. Details
The delete process will contain 3 steps. The first step in verification is to construct a sqlplus statement, along with the user that identifies the data that needs to be deleted. This preliminary verification probably will be done using sqlplus. The verification process is a series of counts from the sam tables, along with a list of data_file names, that will reflect what is being choosen for deletion. The process will be iterative, run many times until the data file names and numbers seem reasonable by the ods person and the user. This process will also report any child data file records that will be deleted as a result of the parent data file being deleted. Once the sqlplus statement identifying the problem is complete, it will be used in the next processes. For example: select file_id from data_files df where df.file_name like 'Stream_%_00%_%' and df.appl_family_id =19 and df.stream_id in (17,18,19,20,21,27,28,38) and df.file_name not like 'S%_031%@031%.raw';

The tagging process will set table statuses to 'pending delete', a logic delete, in all available tables. There will be tables that have no status, and will be deleted from as well. Once a data file has a 'pending delete' status, it must be segregated from the non deleted data. 'Pending delete' data should not be included in any queries, projects, snapshots, processes, etc. After a time, when it is jointly decided that the pending delete data can be phyiscally deleted, a third and final step will be run. Currently, the following tables have status columns and can be tagged. Others may be needed, but do not current have status columns.