From: Mike Bayer Date: Sat, 20 Jan 2007 21:00:08 +0000 (+0000) Subject: - mysql table create options work on a generic passthru now, i.e. Table(..., mysql_en... X-Git-Tag: rel_0_3_4~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c95faa5e8d171160e0786c7e5b8064eb4fd524bb;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - mysql table create options work on a generic passthru now, i.e. Table(..., mysql_engine='InnoDB', mysql_collate="latin1_german2_ci", mysql_auto_increment="5", mysql_...), helps [ticket:418] --- diff --git a/CHANGES b/CHANGES index d4be09ac06..6e9f8c2c27 100644 --- a/CHANGES +++ b/CHANGES @@ -43,6 +43,9 @@ - mysql: - mysql is inconsistent with what kinds of quotes it uses in foreign keys during a SHOW CREATE TABLE, reflection updated to accomodate for all three styles [ticket:420] + - mysql table create options work on a generic passthru now, i.e. Table(..., mysql_engine='InnoDB', + mysql_collate="latin1_german2_ci", mysql_auto_increment="5", mysql_...), + helps [ticket:418] - firebird: - order of constraint creation puts primary key first before all other constraints; required for firebird, not a bad idea for others [ticket:408] diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py index 0edcbc7bd0..aee26a405d 100644 --- a/lib/sqlalchemy/databases/mysql.py +++ b/lib/sqlalchemy/databases/mysql.py @@ -477,11 +477,12 @@ class MySQLSchemaGenerator(ansisql.ANSISchemaGenerator): return colspec def post_create_table(self, table): - mysql_engine = table.kwargs.get('mysql_engine', None) - if mysql_engine is not None: - return " TYPE=%s" % mysql_engine - else: - return "" + args = "" + for k in table.kwargs: + if k.startswith('mysql_'): + opt = k[6:] + args += " %s=%s" % (opt.upper(), table.kwargs[k]) + return args class MySQLSchemaDropper(ansisql.ANSISchemaDropper): def visit_index(self, index): diff --git a/test/sql/query.py b/test/sql/query.py index ac62eb8e92..bffb37e6bb 100644 --- a/test/sql/query.py +++ b/test/sql/query.py @@ -158,8 +158,11 @@ class QueryTest(PersistTest): self.assert_(r==[(3, 'ed'), (4, 'wendy'), (5, 'laura')]) r = self.users.select(offset=5, order_by=[self.users.c.user_id]).execute().fetchall() self.assert_(r==[(6, 'ralph'), (7, 'fido')]) - + + @testbase.unsupported('mysql') def test_scalar_select(self): + """test that scalar subqueries with labels get their type propigated to the result set.""" + # mysql and/or mysqldb has a bug here, type isnt propigated for scalar subquery. datetable = Table('datetable', metadata, Column('id', Integer, primary_key=True), Column('today', DateTime))