From c95faa5e8d171160e0786c7e5b8064eb4fd524bb Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 20 Jan 2007 21:00:08 +0000 Subject: [PATCH] - 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] --- CHANGES | 3 +++ lib/sqlalchemy/databases/mysql.py | 11 ++++++----- test/sql/query.py | 5 ++++- 3 files changed, 13 insertions(+), 6 deletions(-) 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)) -- 2.47.2