#NEWLINE# def insert_many( self , rows , chunk_size = 1000 , ensure = None , types = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# "\n        Add many rows at a time.\n\n        This is significantly faster than adding them one by one. Per default\n        the rows are processed in chunks of 1000 per commit, unless you specify\n        a different ``chunk_size``.\n\n        See :py:meth:`insert() <dataset.Table.insert>` for details on\n        the other parameters.\n        ::\n\n            rows = [dict(name='Dolly')] * 10000\n            table.insert_many(rows)\n        " #NEWLINE# ensure = ( self . database . ensure_schema if ( ensure is None ) else ensure ) #NEWLINE# def _process_chunk( chunk ) : #NEWLINE# #INDENT# if ensure : #NEWLINE# #INDENT# for row in chunk : #NEWLINE# #INDENT# self . _ensure_columns ( row , types = types ) #NEWLINE# #UNINDENT# #UNINDENT# self . table . insert ( ) . execute ( chunk ) #NEWLINE# #UNINDENT# self . _check_dropped ( ) #NEWLINE# chunk = [ ] #NEWLINE# for ( i , row ) in enumerate ( rows , start = 1 ) : #NEWLINE# #INDENT# chunk . append ( row ) #NEWLINE# if ( ( i % types ) == 0 ) : #NEWLINE# #INDENT# _process_chunk ( chunk ) #NEWLINE# chunk = [ ] #NEWLINE# #UNINDENT# #UNINDENT# if chunk : #NEWLINE# #INDENT# _process_chunk ( chunk )