summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/mysql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-02-05 23:45:07 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-02-05 23:45:07 +0000
commit3e23358d6fec43d85a734eff72b62a17e27c25d4 (patch)
treee052350d38cd85c235b25a75113e8b9c845af2bf /lib/sqlalchemy/databases/mysql.py
parent8cfa5b788ab00e44c94dffb7be92473b908e96d2 (diff)
downloadsqlalchemy-3e23358d6fec43d85a734eff72b62a17e27c25d4.tar.gz
table supports per-engine-type options, ansisql allows engines
to add a "post table create" string mysql gets mysql_engine argument InnoDB set as default in engines test
Diffstat (limited to 'lib/sqlalchemy/databases/mysql.py')
-rw-r--r--lib/sqlalchemy/databases/mysql.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py
index 5dd89d97e..569ba6869 100644
--- a/lib/sqlalchemy/databases/mysql.py
+++ b/lib/sqlalchemy/databases/mysql.py
@@ -92,7 +92,6 @@ ischema_names = {
'blob' : MSBinary,
}
-
def engine(opts, **params):
return MySQLEngine(opts, **params)
@@ -125,9 +124,10 @@ class MySQLEngine(ansisql.ANSISQLEngine):
def supports_sane_rowcount(self):
return False
- def tableimpl(self, table):
+ def tableimpl(self, table, **kwargs):
"""returns a new sql.TableImpl object to correspond to the given Table object."""
- return MySQLTableImpl(table)
+ mysql_engine = kwargs.pop('mysql_engine', None)
+ return MySQLTableImpl(table, mysql_engine=mysql_engine)
def compiler(self, statement, bindparams, **kwargs):
return MySQLCompiler(self, statement, bindparams, **kwargs)
@@ -189,7 +189,9 @@ class MySQLTableImpl(sql.TableImpl):
"""attached to a schema.Table to provide it with a Selectable interface
as well as other functions
"""
- pass
+ def __init__(self, table, mysql_engine=None):
+ super(MySQLTableImpl, self).__init__(table)
+ self.mysql_engine = mysql_engine
class MySQLCompiler(ansisql.ANSICompiler):
def limit_clause(self, select):
@@ -218,3 +220,9 @@ class MySQLSchemaGenerator(ansisql.ANSISchemaGenerator):
colspec += ", FOREIGN KEY (%s) REFERENCES %s(%s)" % (column.name, column.column.foreign_key.column.table.name, column.column.foreign_key.column.name)
return colspec
+ def post_create_table(self, table):
+ if table.mysql_engine is not None:
+ return " ENGINE=%s" % table.mysql_engine
+ else:
+ return ""
+