#NEWLINE# def _compare_tables( conn_table_names , metadata_table_names , object_filters , inspector , metadata , diffs , autogen_context ) : #NEWLINE# #INDENT# for ( s , tname ) in metadata_table_names . difference ( conn_table_names ) : #NEWLINE# #INDENT# name = ( ( '%s.%s' % ( s , tname ) ) if s else tname ) #NEWLINE# metadata_table = metadata . tables [ sa_schema . _get_table_key ( tname , s ) ] #NEWLINE# if _run_filters ( metadata_table , tname , 'table' , False , None , object_filters ) : #NEWLINE# #INDENT# diffs . append ( ( 'add_table' , metadata . tables [ name ] ) ) #NEWLINE# log . info ( 'Detected added table %r' , name ) #NEWLINE# _compare_indexes_and_uniques ( s , tname , object_filters , None , metadata_table , diffs , autogen_context , inspector ) #NEWLINE# #UNINDENT# #UNINDENT# removal_metadata = sa_schema . MetaData ( ) #NEWLINE# for ( s , tname ) in conn_table_names . difference ( metadata_table_names ) : #NEWLINE# #INDENT# name = sa_schema . _get_table_key ( tname , s ) #NEWLINE# exists = ( name in removal_metadata . tables ) #NEWLINE# t = sa_schema . Table ( tname , removal_metadata , schema = s ) #NEWLINE# if ( not exists ) : #NEWLINE# #INDENT# inspector . reflecttable ( t , None ) #NEWLINE# #UNINDENT# if _run_filters ( t , autogen_context , 'table' , True , None , object_filters ) : #NEWLINE# #INDENT# diffs . append ( ( 'remove_table' , t ) ) #NEWLINE# log . info ( 'Detected removed table %r' , name ) #NEWLINE# #UNINDENT# #UNINDENT# existing_tables = conn_table_names . intersection ( metadata_table_names ) #NEWLINE# existing_metadata = sa_schema . MetaData ( ) #NEWLINE# conn_column_info = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( s , tname ) in existing_tables : #NEWLINE# #INDENT# name = sa_schema . _get_table_key ( tname , s ) #NEWLINE# exists = ( name in existing_metadata . tables ) #NEWLINE# t = sa_schema . Table ( tname , existing_metadata , schema = s ) #NEWLINE# if ( not exists ) : #NEWLINE# #INDENT# inspector . reflecttable ( t , None ) #NEWLINE# #UNINDENT# conn_column_info [ ( s , tname ) ] = t #NEWLINE# #UNINDENT# for ( s , tname ) in sorted ( existing_tables ) : #NEWLINE# #INDENT# name = ( ( '%s.%s' % ( s , tname ) ) if s else tname ) #NEWLINE# metadata_table = metadata . tables [ name ] #NEWLINE# conn_table = existing_metadata . tables [ name ] #NEWLINE# if _run_filters ( metadata_table , tname , 'table' , False , conn_table , object_filters ) : #NEWLINE# #INDENT# _compare_columns ( s , tname , object_filters , conn_table , metadata_table , diffs , autogen_context , inspector ) #NEWLINE# _compare_indexes_and_uniques ( s , tname , object_filters , conn_table , metadata_table , diffs , autogen_context , inspector )