#NEWLINE# def to_map( self , opts ) : #NEWLINE# #INDENT# 'Convert a foreign table to a YAML-suitable format\n\n        :param opts: options to include/exclude tables, etc.\n        :return: dictionary\n        ' #NEWLINE# if ( hasattr ( cols , 'excl_tables' ) and opts . excl_tables and ( self . name in opts . excl_tables ) ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if ( not hasattr ( self , 'columns' ) ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# cols = [ ] #NEWLINE# for i in range ( len ( self . columns ) ) : #NEWLINE# #INDENT# col = self . columns [ i ] . to_map ( opts . no_privs ) #NEWLINE# if col : #NEWLINE# #INDENT# cols . append ( col ) #NEWLINE# #UNINDENT# #UNINDENT# tbl = { #NEWLINE# #INDENT# 'columns' : cols , #NEWLINE# 'server' : self . server , #NEWLINE# #UNINDENT# } #NEWLINE# attrlist = [ 'options' ] #NEWLINE# if ( self . description is not None ) : #NEWLINE# #INDENT# attrlist . append ( 'description' ) #NEWLINE# #UNINDENT# if ( not opts . no_owner ) : #NEWLINE# #INDENT# attrlist . append ( 'owner' ) #NEWLINE# #UNINDENT# for attr in attrlist : #NEWLINE# #INDENT# if hasattr ( self , attr ) : #NEWLINE# #INDENT# tbl . update ( { #NEWLINE# #INDENT# attr : getattr ( self , attr ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( not opts . no_privs ) and self . privileges ) : #NEWLINE# #INDENT# tbl . update ( { #NEWLINE# #INDENT# 'privileges' : self . map_privs ( ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# return tbl