@@ -0,0 +1,3152 @@
+# Copyright 2014 Rico Antonio Felix%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# You may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A%0Aimport os%0Aimport sqlite3%0A%0A%0Aclass DatabaseScript:%0A    %22%22%22This module is used to populate the specified database with sample records for the purpose of simulation.%22%22%22%0A    @staticmethod%0A    def load_database(database_file):%0A        %22%22%22Populates the specified database file with sample data for simulation.%0A%0A        If the specified database file already exist no operation is performed, else the file is created and populated%0A        with the sample data.%0A%0A        Checks that the argument 'database_file' passed in is of type 'str' else an 'Exception' is raised.%0A%0A        :param database_file: Name of the database file to populate with sample data%0A        :return: None%0A        %22%22%22%0A        if type(database_file) != str:%0A            raise Exception(%0A                %22Invalid argument: database_file of type %7B%7D should be: %3Cclass 'str'%3E%22.format(type(database_file)))%0A        if os.path.exists(database_file):%0A            return%0A        else:%0A            connection = sqlite3.connect(database_file)%0A            connection.execute(%0A                %22CREATE TABLE accounts (account_number TEXT, first_name TEXT, last_name TEXT, balance INT, pin TEXT)%22)%0A            connection.execute(%0A                %22INSERT INTO accounts (account_number, first_name, last_name, balance, pin)%22%0A                %22 VALUES ('10001', 'David', 'Chen', 10000, '2050')%22)%0A            connection.execute(%0A                %22INSERT INTO accounts (account_number, first_name, last_name, balance, pin)%22%0A                %22 VALUES ('10002', 'Rico', 'Felix', 10000, '9014')%22)%0A            connection.execute(%0A                %22INSERT INTO accounts (account_number, first_name, last_name, balance, pin)%22%0A                %22 VALUES ('10003', 'Mark', 'Hurd', 120000, '5572')%22)%0A            connection.execute(%0A                %22INSERT INTO accounts (account_number, first_name, last_name, balance, pin)%22%0A                %22 VALUES ('10004', 'Susan', 'Barbara', 9000, '9393')%22)%0A            connection.execute(%0A                %22INSERT INTO accounts (account_number, first_name, last_name, balance, pin)%22%0A                %22 VALUES ('10005', 'Wayne', 'Mark', 250, '8226')%22)%0A            connection.execute(%0A                %22INSERT INTO accounts (account_number, first_name, last_name, balance, pin)%22%0A                %22 VALUES ('10006', 'Yevette', 'Pauline', 20, '1022')%22)%0A            connection.execute(%0A                %22INSERT INTO accounts (account_number, first_name, last_name, balance, pin)%22%0A                %22 VALUES ('10007', 'Maxwell', 'Richards', 300, '9584')%22)%0A            connection.commit()%0A            connection.close()%0A

Create DatabaseScript.py