(self.preparer.quote(self._validate_identifier(index.name, False), index.quote),
self.preparer.format_table(index.table))
- def visit_drop_foreignkey(self, drop):
+ def visit_drop_constraint(self, drop):
constraint = drop.element
- return "ALTER TABLE %s DROP FOREIGN KEY %s" % \
+ is_fk = isinstance(constraint, sa_schema.ForeignKeyConstraint)
+ return "ALTER TABLE %s DROP %s%s" % \
(self.preparer.format_table(constraint.table),
+ is_fk and "FOREIGN KEY " or "",
self.preparer.format_constraint(constraint))
class MySQLTypeCompiler(compiler.GenericTypeCompiler):
self._server_casing = self._detect_casing(connection)
self._server_collations = self._detect_collations(connection)
self._server_ansiquotes = self._detect_ansiquotes(connection)
+
if self._server_ansiquotes:
self.preparer = MySQLANSIIdentifierPreparer
else:
row = self._compat_fetchone(
connection.execute("SHOW VARIABLES LIKE 'sql_mode'"),
charset=self._connection_charset)
+
if not row:
mode = ''
else:
def __init__(self, dialect):
super(MySQLIdentifierPreparer, self).__init__(dialect, initial_quote="`")
-
+
def _escape_identifier(self, value):
return value.replace('`', '``')
ddl = DDL('%(schema)s-%(table)s-%(fullname)s')
- dialect = testing.db.dialect
+ dialect = self.mock_engine().dialect
self.assert_compile(ddl.against(sane_alone), '-t-t', dialect=dialect)
self.assert_compile(ddl.against(sane_schema), 's-t-s.t', dialect=dialect)
self.assert_compile(ddl.against(insane_alone), '-"t t"-"t t"', dialect=dialect)
listeners.append(testing_reaper)
engine = create_engine(url, **options)
-
+
+ # may want to call this, results
+ # in first-connect initializers
+ #engine.connect()
+
return engine
def utf8_engine(url=None, options=None):