from sqlalchemy.dialects.mysql.base import (MySQLDialect,
MySQLExecutionContext, MySQLCompiler, MySQLIdentifierPreparer,
- BIT, NUMERIC)
+ BIT, NUMERIC, _NumericType)
from sqlalchemy.engine import base as engine_base, default
from sqlalchemy.sql import operators as sql_operators
def post_process_text(self, text):
return text.replace('%', '%%')
+class _DecimalType(_NumericType):
+ def result_processor(self, dialect, coltype):
+ if self.asdecimal:
+ return None
+ return processors.to_float
+
+class _myconnpyNumeric(_DecimalType, NUMERIC):
+ pass
class MySQL_mysqlconnectorIdentifierPreparer(MySQLIdentifierPreparer):
value = value.replace(self.escape_quote, self.escape_to_quote)
return value.replace("%", "%%")
-class _myconnpyNumeric(NUMERIC):
- def result_processor(self, dialect, coltype):
- if self.asdecimal:
- return None
- return processors.to_float
-
class _myconnpyBIT(BIT):
def result_processor(self, dialect, coltype):
"""MySQL-connector already converts mysql bits, so."""
opts['buffered'] = True
opts['raise_on_warnings'] = True
+ # FOUND_ROWS must be set in ClientFlag to enable
+ # supports_sane_rowcount.
+ if self.dbapi is not None:
+ try:
+ from mysql.connector.constants import ClientFlag
+ client_flags = opts.get('client_flags', ClientFlag.get_default())
+ client_flags |= ClientFlag.FOUND_ROWS
+ opts['client_flags'] = client_flags
+ except:
+ pass
return [[], opts]
def _get_server_version_info(self, connection):
self._test_onetomany(True)
# PG etc. need passive=True to allow PK->PK cascade
- @testing.fails_on_everything_except('sqlite', 'mysql+mysqlconnector')
+ @testing.fails_on_everything_except('sqlite')
def test_onetomany_nonpassive(self):
self._test_onetomany(False)
self._test_pk(True)
# PG etc. need passive=True to allow PK->PK cascade
- @testing.fails_on_everything_except('sqlite', 'mysql+mysqlconnector')
+ @testing.fails_on_everything_except('sqlite')
def test_pk_nonpassive(self):
self._test_pk(False)
self._test_fk(True)
# PG etc. need passive=True to allow PK->PK cascade
- @testing.fails_on_everything_except('sqlite', 'mysql+mysqlconnector')
+ @testing.fails_on_everything_except('sqlite')
def test_fk_nonpassive(self):
self._test_fk(False)