summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/mysql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-04-17 20:49:35 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-04-17 20:49:35 +0000
commitaabb6e530b05bee9cc5c2382a308a987abd6168e (patch)
treecd937947baf100d75e679e2f6d40e3a287ffc196 /lib/sqlalchemy/databases/mysql.py
parent8d7a271b8687dbcb58cac713f9e16e445d242881 (diff)
downloadsqlalchemy-aabb6e530b05bee9cc5c2382a308a987abd6168e.tar.gz
- the dialects within sqlalchemy.databases become a setuptools
entry points. loading the built-in database dialects works the same as always, but if none found will fall back to trying pkg_resources to load an external module [ticket:521]
Diffstat (limited to 'lib/sqlalchemy/databases/mysql.py')
-rw-r--r--lib/sqlalchemy/databases/mysql.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py
index d3a42ccdc..21f8bb398 100644
--- a/lib/sqlalchemy/databases/mysql.py
+++ b/lib/sqlalchemy/databases/mysql.py
@@ -12,9 +12,6 @@ import sqlalchemy.types as sqltypes
import sqlalchemy.exceptions as exceptions
from array import array
-def dbapi():
- import MySQLdb as mysql
- return mysql
def kw_colspec(self, spec):
if self.unsigned:
@@ -280,6 +277,11 @@ class MySQLDialect(ansisql.ANSIDialect):
def __init__(self, **kwargs):
ansisql.ANSIDialect.__init__(self, default_paramstyle='format', **kwargs)
+ def dbapi(cls):
+ import MySQLdb as mysql
+ return mysql
+ dbapi = classmethod(dbapi)
+
def create_connect_args(self, url):
opts = url.translate_connect_args(['host', 'db', 'user', 'passwd', 'port'])
opts.update(url.query)