pymysql_sa
A PyMySQL dialect for SQLAlchemy.
This package provides a PyMySQL dialect for SQLAlchemy.
Download and installation
The package is available from the Python Package Index and can be installed as follows:
easy_install pymysql_sa
You can also check the code on bitbucket.
Usage
PyMySQL is « a pure Python MySQL client providing a DB-API to a MySQL database by talking directly to the server via the binary client/server protocol ».
You can explicitly use PyMySQL in SQLAlchemy by changing the 'mysql' part of your engine url to 'pymysql'.
You can also make PyMySQL the default MySQL dialect for SA as follows:
import pymysql_sa pymysql_sa.make_default_mysql_dialect()
In this case you don't need to change the engine url.
Being pure Python, PyMySQL is easily patched by gevent and the likes to make it cooperative.
Future directions
A patch is being worked on aiming to directly support PyMySQL in SQLAlchemy.
We maintain a fork of PyMySQL for the moments the main branch doesn't pass SQLAlchemy's test suite.
License
pymysql_sa is released under the MIT License:
Copyright (c) 2010 Evax S.A.R.L. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
