home / docs / sections

sections: internals:database-execute-write-many

This data as json

id page ref title content breadcrumbs references
internals:database-execute-write-many internals database-execute-write-many await db.execute_write_many(sql, params_seq, block=True) Like execute_write() but uses the sqlite3 conn.executemany() method. This will efficiently execute the same SQL statement against each of the parameters in the params_seq iterator, for example: await db.execute_write_many( "insert into characters (id, name) values (?, ?)", [(1, "Melanie"), (2, "Selma"), (2, "Viktor")], ) Each call to execute_write_many() will be executed inside a transaction. ["Internals for plugins", "Database class"] [{"href": "https://docs.python.org/3/library/sqlite3.html#sqlite3.Cursor.executemany", "label": "conn.executemany()"}]
Powered by Datasette · Queries took 1.124ms