Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

mysql binlog to blinker signal

Project Description

Python MySQL Replication Blinker


This package uses
`mysql-replication <>`__
to read events from MySQL's binlog and send to blinker's signal.

- binlog action level
- schema level
- table level
- row level

It will send RowsEvent only.

Whenever a binlog event come, it will be dispatched into some signals:

#. binlog\_signal: 1 signal for the binlog event.
#. schema\_signal: 1 signal for the event's schema
#. table\_signal: 1 signal for the event's table.
#. row\_signal: 1+ signals for event's rows. 1 signal per row.


.. code-block::

binlog event -> binlog signal -> schema signal -> table signal --> row signals

So, suppose that an event come with schema=foo, table=bar and it updated
2 rows. Those signal will be sent:

| signal | signal name | sender |
| binlog signal | ``update`` | event (RowsEvent) |
| schema signal | ``update@foo`` | event (RowsEvent) |
| table signal | ```` | event.rows (list of array) |
| row signal | ```` | row1 (array) |
| row signal | ```` | row2 object (array) |

Connect to signals

To connect to a signal, you can use the signal instance or a decorator.

Suppose that you need to connect to write signal on table

.. code-block:: python

from pymysqlblinker import signals

tbl1_signal = signals.table_write('db0', 'table1')

def subscriber1(rows, schema, table):

# use connect function

# or use decorator
@signals.on_table_write('db0', 'table1')
def subscriber1(rows, schema, table):

Signal publishing

To start publishing signals

.. code-block:: python

from pymysqlblinker import start_publishing



This package support a method to replicate from mysql database. It
operates by keep memory at last binlog position. By default, it save to a file.

To make it, call:

.. code-block:: python

from pymysqlblinker import start_replication


Change logs


- Add BinlogPosMemory to allow replication: replication is publishing
ability to remember last binlog position. For the first run, it will
start at
the end of current binlog.


- Add connect\_timeout argument to pub.start\_publishing

Release History

This version
History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(5.8 kB) Copy SHA256 Hash SHA256
Source None Aug 18, 2015

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting