Published on : July 29, 2020
#before we actual start seeding we rest some config value
    UPDATE data_store_config SET process_restart_id = 0 ,job_last_id = 0 ,job_token = '' WHERE data_store_id = 'loan_dataset_seed' ;

#we make loan_data_seed table empty
      truncate table data_changes.loan_data_seed;
      set session transaction isolation level read committed;
      drop  TEMPORARY table IF EXISTS t_objects;

#Create temporary table for faster execution to insert sublan_id as object_id
      CREATE TEMPORARY TABLE t_objects (
      object_id varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL
      ) ENGINE=InnoDB;

#insert data into temporary table
      insert into t_objects
      select distinct sublan_id from loan_entries;

      truncate table data_changes.sublan_data_seed;

#insert sublan_id for seeding
      insert ignore into data_changes.sublan_data_seed(stamp,object_id,activity,object_type)
      select RIGHT(CONCAT('00000000000', row_number() over()),12) as stamp,object_id,'changed','sublan' from t_objects; **//