
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Run large MySQL UPDATE and DELETE queries with small batches to prevent table/row-level locks
|Pypi| |Build Status| |codecov| |MIT licensed|
Updating or deleting a large amount of rows in MySQL will create locks that will paralyze other queries running in parallel.
This tool will run UPDATE and DELETE queries in small batches to prevent table-level and row-level locking (with InnoDB). If a large number of rows has to be updated or deleted, it is also possible to limit the number of rows selected at once.
::
pip3 install mysql_batch
You can run this example with the schema available in
sample_table/schema.sql <sample_table/schema.sql>
__
The following example will be identical to the following update:
.. code:: sql
UPDATE batch_test SET date = NOW() WHERE number > 0.2 AND date is NULL;
This is the equivalent to process this update with batches of 20 rows:
.. code:: bash
mysql_batch --host localhost
--user root
--password secret_password
--database "test"
--table "batch_test"
--write_batch_size 20
--where "number > 0.2 AND date IS NULL"
--set "date = NOW()"
Output sample:
.. code:: bash
The following example will be identical to the following delete:
.. code:: sql
DELETE FROM batch_test WHERE number > 0.2 AND date is NULL;
This is the equivalent to process this delete with batches of 20 rows:
.. code:: bash
mysql_batch --host localhost
--user root
--password secret_password
--database "test"
--table "batch_test"
--write_batch_size 20
--where "number > 0.2 AND date IS NULL"
--action "delete"
Output sample:
.. code:: bash
.. code:: bash
usage: mysql_batch [-h] [-H HOST] [-P PORT] -U USER [-p PASSWORD] -d DATABASE -t TABLE [-id PRIMARY_KEY] -w WHERE [-s SET] [-rbz READ_BATCH_SIZE] [-wbz WRITE_BATCH_SIZE] [-S SLEEP] [-a {update,delete}] [-n]
optional arguments: -h, --help show this help message and exit -H HOST, --host HOST MySQL server host -P PORT, --port PORT MySQL server port -U USER, --user USER MySQL user -p PASSWORD, --password PASSWORD MySQL password -d DATABASE, --database DATABASE MySQL database name -t TABLE, --table TABLE MySQL table -id PRIMARY_KEY, --primary_key PRIMARY_KEY Name of the primary key column -w WHERE, --where WHERE Select WHERE clause -s SET, --set SET Update SET clause -rbz READ_BATCH_SIZE, --read_batch_size READ_BATCH_SIZE Select batch size -wbz WRITE_BATCH_SIZE, --write_batch_size WRITE_BATCH_SIZE Update/delete batch size -S SLEEP, --sleep SLEEP Sleep after each batch -a {update,delete}, --action {update,delete} Action ('update' or 'delete') -n, --no_confirm Don't ask for confirmation before to run the write queries
This program is under MIT license (view license <LICENSE>
__).
.. |Pypi| image:: https://img.shields.io/pypi/v/mysql-batch.svg :target: https://pypi.org/project/mysql-batch .. |Build Status| image:: https://github.com/gabfl/mysql-batch/actions/workflows/ci.yml/badge.svg?branch=main :target: https://github.com/gabfl/mysql-batch/actions .. |codecov| image:: https://codecov.io/gh/gabfl/mysql-batch/branch/main/graph/badge.svg :target: https://codecov.io/gh/gabfl/mysql-batch .. |MIT licensed| image:: https://img.shields.io/badge/license-MIT-green.svg :target: https://raw.githubusercontent.com/gabfl/mysql-batch/main/LICENSE
FAQs
Run large MySQL UPDATE and DELETE queries with small batches to prevent table/row-level locks
We found that mysql-batch demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.