def next_create_subtask_step(message):
name_task = message.text
sqlb = "SELECT id FROM tasks WHERE id = 6"
print(sqlb)
db.execute(sqlb)
task_id = db.fetchone()
print(task_id)
task = task_id[0]
data_subtask['id_task'] = task
msg = bot.reply_to(message, 'Придумайте название подзадачи')
bot.register_next_step_handler(msg, request_subtask)
sqlb = "SELECT id FROM tasks WHERE name = '{}'".format(name_task)
db.execute(sqlb)
task_id = db.fetchone()
task = task_id[0]
/**
* Save an array of new models and attach them to the parent model.
*
* @param \Illuminate\Support\Collection|array $models
* @param array $pivotAttributes
* @return array
*/
public function saveMany($models, array $pivotAttributes = [])
{
foreach ($models as $key => $model) {
$this->save($model, (array) ($pivotAttributes[$key] ?? []), false);
}
$this->touchIfTouching();
return $models;
}
ls -lah /tmp/ | grep sql
-rw-r--r-- 1 vagrant vagrant 2.8M May 12 07:41 bulk.sql
-rw-r--r-- 1 vagrant vagrant 3.9M May 12 07:39 no_bulk_commit.sql
-rw-r--r-- 1 vagrant vagrant 3.9M May 12 07:36 no_bulk_no_commit.sql
time mysql -u root temp < /tmp/bulk.sql
real 0m2.375s
user 0m0.035s
sys 0m0.008s
time mysql -u root temp < /tmp/no_bulk_no_commit.sql
real 1m11.508s
user 0m0.341s
sys 0m0.586s
time mysql -u root temp < /tmp/no_bulk_commit.sql
real 1m0.423s
user 0m0.427s
sys 0m0.589s