]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- rename "myconnpy" to "mysqlconnector"
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 4 Jan 2010 16:26:01 +0000 (16:26 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 4 Jan 2010 16:26:01 +0000 (16:26 +0000)
- remove all bug workarounds in mysqlconnector dialect
- add mysqlconnector as one of two "official" DBAPIs for MySQL

doc/build/dbengine.rst
doc/build/reference/dialects/mysql.rst
lib/sqlalchemy/dialects/mysql/mysqlconnector.py [moved from lib/sqlalchemy/dialects/mysql/myconnpy.py with 60% similarity]

index c1f2c2850f81197996a0b6154263474ec76bbcac..4e9b0f4b9a653e466a80db0a716832bc5c635d00 100644 (file)
@@ -67,7 +67,7 @@ Downloads for each DBAPI at the time of this writing are as follows:
   - PostgreSQL:  `psycopg2 <http://www.initd.org/tracker/psycopg/wiki/PsycopgTwo>`_ `pg8000 <http://pybrary.net/pg8000/>`_
   - PostgreSQL on Jython: `PostgreSQL JDBC Driver <http://jdbc.postgresql.org/>`_
   - SQLite:  `sqlite3 <http://www.python.org/doc/2.5.2/lib/module-sqlite3.html>`_ (included in Python 2.5 or greater) `pysqlite <http://initd.org/tracker/pysqlite>`_
-  - MySQL:   `MySQLdb (a.k.a. mysql-python) <http://sourceforge.net/projects/mysql-python>`_
+  - MySQL:   `MySQLdb (a.k.a. mysql-python) <http://sourceforge.net/projects/mysql-python>`_ `MySQL Connector/Python <https://launchpad.net/myconnpy>`_
   - MySQL on Jython: `MySQL Connector/J JDBC driver <http://dev.mysql.com/downloads/connector/j/>`_
   - Oracle:  `cx_Oracle <http://cx-oracle.sourceforge.net/>`_
   - Oracle on Jython:  `Oracle JDBC Driver <http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html>`_
index c45da7423467cbd7ee2c510b3eb0c9445b0a8bd1..f05d751c556c29fe4eaabafd9da31bc26943db20 100644 (file)
@@ -148,10 +148,10 @@ OurSQL Notes
 
 .. automodule:: sqlalchemy.dialects.mysql.oursql
 
-MyConnPY Notes
-----------------
+MySQL-Connector Notes
+----------------------
 
-.. automodule:: sqlalchemy.dialects.mysql.myconnpy
+.. automodule:: sqlalchemy.dialects.mysql.mysqlconnector
 
 pyodbc Notes
 --------------
similarity index 60%
rename from lib/sqlalchemy/dialects/mysql/myconnpy.py
rename to lib/sqlalchemy/dialects/mysql/mysqlconnector.py
index f8e6d1254baafb9d0bc98545d072b2535b9a0951..ac102f94a3c281fe20ddf1c71f123432cf4e0fca 100644 (file)
@@ -1,13 +1,6 @@
 """Support for the MySQL database via the MySQL Connector/Python adapter.
 
-This dialect is in development pending further progress on this
-new DBAPI.
-
-current issue (2009-10-18):
-
-fetchone() does not obey PEP 249
-
-https://bugs.launchpad.net/myconnpy/+bug/454782
+# TODO: add docs/notes here regarding MySQL Connector/Python
 
 """
 
@@ -20,25 +13,13 @@ from sqlalchemy.engine import base as engine_base, default
 from sqlalchemy.sql import operators as sql_operators
 from sqlalchemy import exc, log, schema, sql, types as sqltypes, util
 
-class MySQL_myconnpyExecutionContext(MySQLExecutionContext):
-    # DBAPI BUG:
-    # fetchone() improperly raises an exception when no rows remain
-    
+class MySQL_mysqlconnectorExecutionContext(MySQLExecutionContext):
     
     def get_lastrowid(self):
-        # DBAPI BUG: wrong name of attribute
-        # https://bugs.launchpad.net/myconnpy/+bug/454782
-        return self.cursor._lastrowid
-        
-        # this is the fallback approach.
-#        cursor = self.create_cursor()
-#        cursor.execute("SELECT LAST_INSERT_ID()")
-#        lastrowid = cursor.fetchone()[0]
-#        cursor.close()
-#        return lastrowid
+        return self.cursor.lastrowid
     
         
-class MySQL_myconnpyCompiler(MySQLCompiler):
+class MySQL_mysqlconnectorCompiler(MySQLCompiler):
     def visit_mod(self, binary, **kw):
         return self.process(binary.left) + " %% " + self.process(binary.right)
     
@@ -46,32 +27,24 @@ class MySQL_myconnpyCompiler(MySQLCompiler):
         return text.replace('%', '%%')
 
 
-class MySQL_myconnpyIdentifierPreparer(MySQLIdentifierPreparer):
+class MySQL_mysqlconnectorIdentifierPreparer(MySQLIdentifierPreparer):
     
     def _escape_identifier(self, value):
         value = value.replace(self.escape_quote, self.escape_to_quote)
         return value.replace("%", "%%")
 
-class MySQL_myconnpy(MySQLDialect):
-    driver = 'myconnpy'
+class MySQL_mysqlconnector(MySQLDialect):
+    driver = 'mysqlconnector'
     supports_unicode_statements = False
     supports_sane_rowcount = True
     supports_sane_multi_rowcount = True
 
     default_paramstyle = 'format'
-    execution_ctx_cls = MySQL_myconnpyExecutionContext
-    statement_compiler = MySQL_myconnpyCompiler
+    execution_ctx_cls = MySQL_mysqlconnectorExecutionContext
+    statement_compiler = MySQL_mysqlconnectorCompiler
     
-    preparer = MySQL_myconnpyIdentifierPreparer
+    preparer = MySQL_mysqlconnectorIdentifierPreparer
     
-    def __init__(self, **kw):
-        # DBAPI BUG:
-        # named parameters don't work:
-        # "Parameters must be given as a sequence."
-        # https://bugs.launchpad.net/myconnpy/+bug/454782
-        kw['paramstyle'] = 'format'
-        MySQLDialect.__init__(self, **kw)
-        
     @classmethod
     def dbapi(cls):
         from mysql import connector
@@ -106,4 +79,4 @@ class MySQL_myconnpy(MySQLDialect):
         else:
             return None
 
-dialect = MySQL_myconnpy
+dialect = MySQL_mysqlconnector