#NEWLINE# def create_snapshot( self , snapshot_name , before_copy = None ) : #NEWLINE# #INDENT# snapshot = Snapshot ( snapshot_name = snapshot_name , project_name = self . config [ 'project_name' ] ) #NEWLINE# self . db . session . add ( snapshot ) #NEWLINE# self . db . session . flush ( ) #NEWLINE# for table_name in self . config [ 'tracked_databases' ] : #NEWLINE# #INDENT# if before_copy : #NEWLINE# #INDENT# before_copy ( table_name ) #NEWLINE# #UNINDENT# table = Table ( table_name = table_name , snapshot = snapshot ) #NEWLINE# logger . debug ( ( 'Copying %s to %s' % ( table_name , table . get_table_name ( 'master' ) ) ) ) #NEWLINE# self . operations . copy_database ( table_name , table . get_table_name ( 'master' ) ) #NEWLINE# self . db . session . add ( snapshot_name ) #NEWLINE# #UNINDENT# self . db . session . commit ( ) #NEWLINE# self . start_background_slave_copy ( snapshot )