def _bulk_insert_into_app_models(self, cursor, app_model, fields, db_values, placeholder_list):
<EOL>num_of_rows_able_to_insert = self.SQLITE_MAX_VARIABLE_NUMBER // len(fields)<EOL>num_of_values_able_to_insert = num_of_rows_able_to_insert * len(fields)<EOL>value_chunks = [db_values[x:x + num_of_values_able_to_insert] for x in range(<NUM_LIT:0>, len(db_values), num_of_values_able_to_insert)]<EOL>placeholder_chunks = [placeholder_list[x: x + num_of_rows_able_to_insert] for x in range(<NUM_LIT:0>, len(placeholder_list), num_of_rows_able_to_insert)]<EOL>fields = str(tuple(str(f.attname) for f in fields)).replace("<STR_LIT:'>", '<STR_LIT>')<EOL>for values, params in zip(value_chunks, placeholder_chunks):<EOL><INDENT>placeholder_str = '<STR_LIT:U+002CU+0020>'.join(params).replace("<STR_LIT:'>", '<STR_LIT>')<EOL>insert = """<STR_LIT>""".format(app_model=app_model, fields=fields, placeholder_str=placeholder_str)<EOL>cursor.execute(insert, values)<EOL><DEDENT>
Example query:
`REPLACE INTO model (F1,F2,F3) VALUES (%s, %s, %s), (%s, %s, %s), (%s, %s, %s)`
where values=[1,2,3,4,5,6,7,8,9]