#NEWLINE# def refresh_schema( self , exclude_system_tables = True , use_cache = False ) : #NEWLINE# #INDENT# "\n        Pulls your database's schema again and looks for any new tables and\n        columns.\n        " #NEWLINE# ( col_meta , table_meta ) = self . _get_db_metadata ( exclude_system_tables , use_cache ) #NEWLINE# tables = self . _gen_tables_from_col_tuples ( col_meta ) #NEWLINE# if use_cache : #NEWLINE# #INDENT# self . _tables = TableSet ( [ Table ( self . con , self . _query_templates , table_meta [ t ] [ 'schema' ] , t , tables [ t ] , keys_per_column = self . keys_per_column , foreign_keys = table_meta [ t ] [ 'foreign_keys' ] [ 'columns' ] , ref_keys = table_meta [ t ] [ 'ref_keys' ] [ 'columns' ] ) for t in sorted ( tables . keys ( ) ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( not use_cache ) and isinstance ( self . _query_templates . get ( 'system' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) . get ( 'foreign_keys_for_db' , None ) , str ) ) : #NEWLINE# #INDENT# self . cur . execute ( self . _query_templates [ 'system' ] [ 'foreign_keys_for_db' ] ) #NEWLINE# table_db_foreign_keys = defaultdict ( list ) #NEWLINE# for rel in self . cur : #NEWLINE# #INDENT# table_db_foreign_keys [ rel [ 1 ] ] . append ( rel ) #NEWLINE# #UNINDENT# self . cur . execute ( self . _query_templates [ 'system' ] [ 'ref_keys_for_db' ] ) #NEWLINE# table_db_ref_keys = defaultdict ( list ) #NEWLINE# for rel in self . cur : #NEWLINE# #INDENT# table_db_ref_keys [ rel [ 1 ] ] . append ( rel ) #NEWLINE# #UNINDENT# self . _tables = TableSet ( [ Table ( self . con , self . _query_templates , tables [ t ] [ 0 ] . schema , t , tables [ t ] , keys_per_column = self . keys_per_column , foreign_keys = table_db_foreign_keys [ t ] , ref_keys = table_db_ref_keys [ t ] ) for t in sorted ( tables . keys ( ) ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not use_cache ) : #NEWLINE# #INDENT# self . _tables = TableSet ( [ Table ( self . con , self . _query_templates , tables [ t ] [ 0 ] . schema , t , tables [ t ] , keys_per_column = self . keys_per_column ) for t in sorted ( tables . keys ( ) ) ] ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# sys . stderr . write ( 'done!\n' )