#NEWLINE# def create_shadow_table( migrate_engine , table_name = None , table = None , **col_name_col_instance ) : #NEWLINE# #INDENT# 'This method create shadow table for table with name ``table_name``\n    or table instance ``table``.\n    :param table_name: Autoload table with this name and create shadow table\n    :param table: Autoloaded table, so just create corresponding shadow table.\n    :param col_name_col_instance:   contains pair column_name=column_instance.\n    column_instance is instance of Column. These params are required only for\n    columns that have unsupported types by sqlite. For example BigInteger.\n    :returns: The created shadow_table object.\n    ' #NEWLINE# meta = MetaData ( bind = migrate_engine ) #NEWLINE# if ( ( table_name is None ) and ( table is None ) ) : #NEWLINE# #INDENT# raise exception . NovaException ( _ ( 'Specify `table_name` or `table` param' ) ) #NEWLINE# #UNINDENT# if ( not ( ( table_name is None ) or ( table is None ) ) ) : #NEWLINE# #INDENT# raise exception . NovaException ( _ ( 'Specify only one param `table_name` `table`' ) ) #NEWLINE# #UNINDENT# if ( table is None ) : #NEWLINE# #INDENT# table = Table ( table_name , meta , autoload = True ) #NEWLINE# #UNINDENT# columns = [ ] #NEWLINE# for column in table . columns : #NEWLINE# #INDENT# if isinstance ( column . type , NullType ) : #NEWLINE# #INDENT# new_column = oslodbutils . _get_not_supported_column ( col_name_col_instance , column . name ) #NEWLINE# columns . append ( new_column ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# columns . append ( column . copy ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# shadow_table_name = ( db . _SHADOW_TABLE_PREFIX + table . name ) #NEWLINE# shadow_table = Table ( shadow_table_name , meta , * columns , mysql_engine = 'InnoDB' ) #NEWLINE# try : #NEWLINE# #INDENT# shadow_table . create ( ) #NEWLINE# return shadow_table #NEWLINE# #UNINDENT# except ( db_exc . DBError , OperationalError ) : #NEWLINE# #INDENT# LOG . info ( repr ( meta ) ) #NEWLINE# LOG . exception ( _LE ( 'Exception while creating table.' ) ) #NEWLINE# raise exception . ShadowTableExists ( name = shadow_table_name ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# LOG . info ( repr ( shadow_table ) ) #NEWLINE# LOG . exception ( _LE ( 'Exception while creating table.' ) )