#NEWLINE# def _get_db_metadata( self , exclude_system_tables , use_cache ) : #NEWLINE# #INDENT# col_meta = [ ] #NEWLINE# table_meta = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( use_cache and self . _metadata_cache ) : #NEWLINE# #INDENT# sys . stderr . write ( 'Loading cached metadata. Please wait...' ) #NEWLINE# for table in self . _metadata_cache : #NEWLINE# #INDENT# table_meta [ table [ 'name' ] ] = { k : table [ k ] for k in ( 'schema' , 'name' , 'foreign_keys' , 'ref_keys' ) } #NEWLINE# for col in schemas_str [ 'columns' ] : #NEWLINE# #INDENT# col_meta . append ( ( col [ 'schema' ] , col [ 'table' ] , col [ 'name' ] , col [ 'type' ] ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# sys . stderr . write ( 'Refreshing schema. Please wait...' ) #NEWLINE# if ( ( self . schemas is not None ) and isinstance ( self . schemas , list ) and ( 'schema_specified' in self . _query_templates [ 'system' ] ) ) : #NEWLINE# #INDENT# schemas_str = ',' . join ( [ repr ( schema ) for schema in self . schemas ] ) #NEWLINE# q = ( self . _query_templates [ 'system' ] [ 'schema_specified' ] % schemas_str ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if exclude_system_tables : #NEWLINE# #INDENT# q = self . _query_templates [ 'system' ] [ 'schema_no_system' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# q = self . _query_templates [ 'system' ] [ 'schema_with_system' ] #NEWLINE# #UNINDENT# #UNINDENT# self . cur . execute ( q ) #NEWLINE# col_meta = self . cur #NEWLINE# #UNINDENT# return ( col_meta , table_meta )