This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

SQLAlchemy Simple Master Slave Load Balancing(*beta*)

You can install Pymysqlslave from PyPI with

$ pip install pymysqlslave

Version update

  • 1.0.6 [BUG]MySQLDBSlave open retry not avaliable
  • 1.0.5 [BUG]MySQLDBSlave slaves unavailable. modify MySQLDBSlave reconnect_retry_nums default => 3
  • 1.0.3 add is_auto_allocation(Automatic Identification master and slave)
  • 1.0.1 initialize project

Getting Started

#!/usr/bin/env python
# coding=utf-8

import logging
logging.basicConfig(level=logging.DEBUG)
from sqlalchemy import select

from pymysqlslave import MySQLDBSlave

jianv1 = MySQLDBSlave(
    masters=[
        {
            "name": "mysql+mysqldb://jianxun:jianxun@jianxun.dev:3306/jianxunv2?charset=utf8",
            "echo": False,
            "pool_size": 5,
            "pool_recycle": 1,
        }
    ],
    slaves=[
        {
            "name": "mysql+mysqldb://jianxun:jianxun@jianxunv2.dev:3306/jianxunv2?charset=utf8",
            "echo": False,
            "pool_size": 5,
            "pool_recycle": 1,
        }
    ],
    is_auto_allocation=True)


def get_info_by_email(email):
    _t = jianv1.table.customer_member_t
    sql = select([_t]).where(_t.c.email == email)
    return jianv1.execute(sql).fetchone()


def update_info_by_email(email):
    _t = jianv1.table.customer_member_t
    sql = _t.update().where(_t.c.email == email).values(name=u"穿完")
    jianv1.execute(sql)


if __name__ == "__main__":
    result = get_info_by_email("592030542@qq.com")
    logging.info(result)
    update_info_by_email("592030542@qq.com")

TODO

  • 根据不同的环境,用户选择不同的slave
  • add retry connecting(bug: interactive_timeout)
  • add is_auto_allocation(Automatic Identification master and slave)
  • Thread Safety

Support

If you need help using pymysqlslave or have found a bug, please open a github issue.

Release History

Release History

1.0.8

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pymysqlslave-1.0.8-py2.7.egg (9.4 kB) Copy SHA256 Checksum SHA256 2.7 Egg Dec 25, 2015
pymysqlslave-1.0.8.tar.gz (4.9 kB) Copy SHA256 Checksum SHA256 Source Dec 25, 2015

Supported By

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